Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #6904
| Newsgroups | comp.lang.ruby |
|---|---|
| Date | 2013-12-24 00:09 -0800 |
| References | (1 earlier) <47A0C40E.7000007@path.berkeley.edu> <491107790801301139v7a83702as8bb0c115cfb5b8bd@mail.gmail.com> <1c036add-6560-47f5-860a-8c9990d61bdf@s8g2000prg.googlegroups.com> <491107790801301629n3327bb65lf5109cdd79ffaa91@mail.gmail.com> <ac2d0887-a4be-4b4b-b46a-dc6803f67bdb@e6g2000prf.googlegroups.com> |
| Message-ID | <08f849e3-dd40-4f63-87fe-11d09f7d4bf3@googlegroups.com> (permalink) |
| Subject | Re: Newbie: working with binary files/extract png from a binary file |
| From | gabriel@agence8.com |
Le vendredi 1 février 2008 12:21:15 UTC+1, Jim a écrit :
> On Jan 30, 7:29 pm, Adam Shelly <adam.she...@gmail.com> wrote:
> >
> >
> > from the same docs:
> > "MatchData acts as an array. ... mtch[0] is equivalent to ... the
> > entire matched string. "
> >
> > so m.begin(0) returns the offset of the start of the matched string
> > (in this case, the start of the png header). Since the string
> > contains the contents of the whole file, the string offset is the same
> > as the file offset we need.
> > -Adam
>
> OK, it's really not that hard is it?
>
> input.read(N) read N bytes from the stream. From the spec we know PNG
> has an header (they call a signature) that is 8 bytes. Check it. If
> it's a PNG, read the chunks until IEND
>
> The only other thing is unpack("N"). From the docs it takes a string
> of 4 bytes and returns a Fixnum.
>
> Thanks again for the code. The file I'm extracting is a SketchUp 3d
> model, btw.
hi
i would like to know how change the size of png extract cause is thumbails and i would like to have bigger png extract
thanks a lot
Gabriel
Back to comp.lang.ruby | Previous | Next | Find similar
Re: Newbie: working with binary files/extract png from a binary file gabriel@agence8.com - 2013-12-24 00:09 -0800
csiph-web