• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: image dimensions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: image dimensions


  • Subject: Re: image dimensions
  • From: "Arthur J Knapp" <email@hidden>
  • Date: Tue, 14 Nov 2000 12:32:05 -0500

> Subject: Re: image dimensions
> From: John McAdams <email@hidden>

> I should be more specific. Is there a way to get horizontal and
> vertical measurements for a Photoshop image in plain AppleScript
> without opening the file in an image editing program?

Disclaimer: The following has NOT been extensively tested, use
at your own risk.


on Dimensions_8BPS(a_file)

-- a_file = alias or file spec

try
set f_ref to open for access a_file

on error m number n
-- your error trap code here
--
error m number n
end try

try

-- File signature
--
set header to (read f_ref for 4)
considering case
if (header is not equal to "8BPS") then
error "" & a_file & " is not a Photoshop file"
end if
end considering

-- move file marker to byte 15
--
read f_ref for 10

-- bytes 15-18 and 19-22
--
set {x, y} to (read f_ref for 8 as integer)

-- close
--
close access f_ref

on error m number n
-- your error trap code here
--
try
close access f_ref
end try
error m number n
end try

-- { Width, Height } in pixels
--
return {x, y}

end Dimensions_8BPS


Dimensions_8BPS(choose file)
--> i.e.: {105, 159}


--
{
Arthur J Knapp, of STELLARViSIONs ;

http://www.STELLARViSIONs.com ;

mailto:email@hidden ;

"... but I could be anyone"
"No you couldn't, sir ..."
}


  • Prev by Date: Modification Date Blues
  • Next by Date: AppleScript, QuarkXpress, PostScript
  • Previous by thread: Re: image dimensions
  • Next by thread: Re:image dimensions
  • Index(es):
    • Date
    • Thread