Re: Get info without opening a file
Re: Get info without opening a file
- Subject: Re: Get info without opening a file
- From: David Lloyd <email@hidden>
- Date: Sat, 10 Feb 2001 20:54:55 +1100
Jan Machalek wrote:
>
Is there a way of getting informations (details) from a file without
>
physically opening the file. Let me clarify... For example, is there a way
>
of knowing resolution, color space, height and width, etc. of an EPS file
>
without physically opening it in Photoshop?
There are ways to retrieve this info from a Photoshop eps via AppleScript.
If this doesn't translate across the internet successfully, I can send it to
via seperate email if you like...
--begin---
global theData, boundsAcross
copy (choose file of type "EPSF") to theFile
open for access theFile
copy (read theFile for 1000) to theData
if character 1 of theData = "%" then
doGetPSInfo()
close access theFile
else --tif preview
copy (read theFile for 300000) to theData
doGetPSInfo()
close access theFile
copy (offset of "%%Creator" in theData) to x
end if
copy (offset of "%Image
Data:" in theData) to theOffset
if theOffset 0 then
copy characters (theOffset + 12) thru (theOffset + 50) in theData as
string to x
copy "" to theData
copy word 1 of x as real to theWidth
copy word 2 of x as real to theHeight
copy word 3 of x as real to numComponents
copy word 4 of x as real to theMode -- bitsPerComponent
copy word 5 of x as real to multipleDataSources -- 1 = true, 0 = false
copy word 6 of x as real to theColumns --imagewidth, but 1 if jpeg
encoding [imagematix?]
copy word 7 of x as real to q -- ?
if theColumns = 1 then display dialog "JPEG encoded"
copy (round (theWidth / boundsAcross * 720) rounding to nearest) / 10 to
theRes
if theMode = 4 then
copy "CMYK" to theMode
else if theMode = 3 then
copy "RGB" to theMode
else if theMode = 1 and numComponents = 8 then
copy "Grayscale" to theMode
else if theMode = 1 and numComponents = 1 then
copy "Line" to theMode
end if
copy theMode & return & theRes & return & theWidth & return & theHeight
as string to x
else
copy "Vector eps" to x
end if
display dialog x buttons "OK" default button 1 with icon 1
on doGetPSInfo()
try
copy (offset of "%%HiResBoundingBox:" in theData) to o
copy characters (o + 20) thru (o + 60) in theData as string to x
copy word 3 of x as real to boundsAcross
--copy word 4 of x as real to boundsDown
on error
copy (offset of "%%BoundingBox:" in theData) to o
copy characters (o + 15) thru (o + 55) in theData as string to x
copy word 3 of x as real to boundsAcross
--copy word 4 of x as real to boundsDown
end try
end doGetPSInfo
--end----
David Lloyd
---------------------------------
email: email@hidden
web:
http://www.kanzu.com
---------------------------------