Re: Looking for Specific Bytes in a File
Re: Looking for Specific Bytes in a File
- Subject: Re: Looking for Specific Bytes in a File
- From: Graff <email@hidden>
- Date: Fri, 13 Feb 2004 14:55:46 -0500
If you are using Panther then Image Events is a component of the
Panther and it can be scripted. The following script gets the
dimensions of an image for you easily:
------------
set theFile to choose file
tell application "Image Events"
set {theWidth, theHeight} to dimensions of image theFile
end tell
------------
This will work on all images files of the following types:
PICT/Photoshop/BMP/QuickTime
Image/GIF/JPEG/MacPaint/JPEG2/SGI/PSD/TGA/Text/PDF/PNG/TIFF
- Ken
On Feb 13, 2004, at 1:38 PM, Marconi wrote:
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.
_______________________________________________
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.