Hey -

have you checked out the PNG spec?  It's pretty clear about how the file is
arranged.

http://www.w3.org/TR/REC-png

Basically using a combination of read/part/skip you should be able to
navigate thru the various chunks to get to the chunk you want.  The first 4
bytes of a chunk indicate its length, and the next 4 indicate the chunk
type.  So - after reading the first 8 bytes of the file to verify it's a
PNG, read the next 8 bytes and take a look at them to see if the next chunk
is a "tEXt" chunk - if not use the length value as the skip in a read...
You'll have to accumulate bytes read and what not though.  But - it'd avoid
you having to scan thru the file for an identifier.

- Porter

----- Original Message -----
From: "Ryan Cole" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 14, 2001 5:29 PM
Subject: [REBOL] Re: do %image.png


> Hey Jason,
> I was mistaken in that my last example only worked well in a "prefaced"
> situation.  What you really want is this:
>
> garblyjunkbinaryfile
> [
>     REBOL []
>     confirm "This is a test."
> ]
> garblyjunkbinaryfile
>
> There is a problem I discovered, a bug probably.  Seems that the null
characters
> in the png file are disrupting REBOL's ability to trigger.  Without nulls
> present, the embedding works fine. Example:
>
> >> write/binary %test "^@^/[ rebol [] confirm {Works?} ]"
> >> do %test
> ** Syntax Error: Script is missing a REBOL header
> ** Where: do-boot
> ** Near: do %test
> >> write/binary %test " ^/[ rebol [] confirm {Works?} ]"
> >> do %test
> == true
> >>
>
> I sent a feedback, hopefully they get around to fixing it soon,
>
> --Ryan
>
>
> Jason Cunliffe wrote:
>
> > "Ryan Cole" <[EMAIL PROTECTED]> wrote
> > > Should be even easier than that.  Just insert something like this into
> > it...
> > >
> > > REBOL[]
> > > confirm "This is a test."
> > > halt
> > >
> > > Just make sure you have the code enveloped in linefeeds.  REBOL was
> > designed to
> > > do this already.
> >
> > Hi Ryyan
> > I don't quite understand you.
> > ..what "this" REBOL was design to do ?
> >
> > How will wrapping my embedded script in linefeeds help?
> > How will I know I am at the end of my script and at some space in the
middle
> > of it?
> >
> > thanks
> > - Jason
> >
> > --
> > To unsubscribe from this list, please send an email to
> > [EMAIL PROTECTED] with "unsubscribe" in the
> > subject, without the quotes.
>
> --
>
>
>      Ryan Cole
>  Programmer Analyst
>  www.iesco-dms.com
>     707-468-5400
>
> The contradiction so puzzling to the ordinary way
> of thinking comes from the fact that we have to use
> language to communicate our inner experience
> which in its very nature transcends lingistics.
> -D.T. Suzuki
>
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>
>

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to