Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #6904

Re: Newbie: working with binary files/extract png from a binary file

X-Received by 10.182.109.200 with SMTP id hu8mr12453406obb.20.1387872580884; Tue, 24 Dec 2013 00:09:40 -0800 (PST)
X-Received by 10.49.128.73 with SMTP id nm9mr5247qeb.37.1387872580844; Tue, 24 Dec 2013 00:09:40 -0800 (PST)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!goblin2!goblin1!goblin.stu.neva.ru!gf10no14731460igb.0!news-out.google.com!l9ni207qay.0!nntp.google.com!p15no41276993qaj.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.ruby
Date Tue, 24 Dec 2013 00:09:40 -0800 (PST)
In-Reply-To <ac2d0887-a4be-4b4b-b46a-dc6803f67bdb@e6g2000prf.googlegroups.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=204.14.77.236; posting-account=xrzNfwoAAAD9bWlaeQv2ARkRCu3IIZnF
NNTP-Posting-Host 204.14.77.236
References <0668931d-e9cb-4ca2-9620-03abbc29df1e@m34g2000hsf.googlegroups.com> <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>
User-Agent G2/1.0
MIME-Version 1.0
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
Injection-Date Tue, 24 Dec 2013 08:09:40 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.lang.ruby:6904

Show key headers only | View raw


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


Thread

Re: Newbie: working with binary files/extract png from a binary file gabriel@agence8.com - 2013-12-24 00:09 -0800

csiph-web