Looking for Specific Bytes in a File
Looking for Specific Bytes in a File
- Subject: Looking for Specific Bytes in a File
- From: Marconi <email@hidden>
- Date: Fri, 13 Feb 2004 11:38:57 -0700
I'm trying to open the data fork of a file and find the first
occurrence of the hex bytes '1108' then grab the following four bytes
and return them as two decimal values.
What I'm doing:
In a JPEG image file, it appears that the image width is in the two
bytes following '1108' and the image height is the next two bytes
after the width. These do not occur at a consistent offset. I'm
intending on scripting some actions that depend on the dimensions of
the JPEG image dropped onto the droplet script.
I'm uncertain how to 'crawl' a file looking for that first '1108'.
Should I convert 1108 to ASCII and search for that? Would it be
better (faster) to search for '11' (or the ASCII thereof) first, then
see if the next byte is '08'? Or would the difference be negligible?
Advice?
--
Good intentions will always be pleaded for any assumption of power.
The Constitution was made to guard the people against the dangers of
good intentions. There are men in all ages who mean to govern well,
but they mean to govern. They promise to be good masters, but they
mean to be masters. -- Daniel Webster
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.