Some time ago someone helped me out when I needed to get image properties from a jpg file, but I discovered that this script doesnt work with EPS files exporterad from Freehand. The script used the application “Image Events”.
Could someone help me out with this? I mainly need the height and width of the file.
Since the EPS format is very well documented you could load the header into memory and search for the bounding box data. You’ll have to do a minimal amount of math to get the info but it’s a very simple task to get this info this way. AND it’s free!
Jonas:
Here’s a quick script that reports the dimensions of a file selected in the Finder. Note: with an EPS file you get the bounds of the image, NOT the page size. So a 1 inch square on an 8.5 x 11 page will report 1 inch. It reports a very exact measurement. (I don’t have any Freehand exported EPS’s but it should work correctly.)
tell application "Finder" to set {aFile, fileVersion} to {(selection as alias), short version of (info for (selection as alias))}
if (fileVersion as integer) ≤ 8 then
set nextLineText to "%%DocumentProcessColors:"
else
set nextLineText to "%%CropBox:" -- version 9 and up has a different header structure that 8 and previous because they're a variant of the PDF file specification
end if
open for access aFile
copy (read aFile from 0 to 500) to myData
close access aFile
set {boundingBoxOffset, nextLine} to the {(offset of "%%HiResBoundingBox:" in myData) + 20, (offset of nextLineText in myData) - 2}
set boundingBoxInfo to every word of ((characters boundingBoxOffset through nextLine) in myData as string)
set xWidth to ((item 3 of boundingBoxInfo as real) - (-(item 1 of boundingBoxInfo as real))) / 72
set yHeight to ((item 4 of boundingBoxInfo as real) - (item 2 of boundingBoxInfo as real)) / 72
display dialog "Width: " & xWidth & return & "Height: " & yHeight
Or you can try that program Craig suggested (I just noticed that it too is free!)