Image Events not saving after scale
Image Events not saving after scale
- Subject: Image Events not saving after scale
- From: Steve Mills <email@hidden>
- Date: Mon, 29 Mar 2010 11:51:23 -0500
If I scale an image, the save is failing without error. Bug or am I doing it wrong?
set arts to {}
try
repeat while true
set fyl to choose file with prompt "Choose the images to add in front-to-back order, 1 at a time." with showing package contents without multiple selections allowed
set end of arts to fyl
end repeat
end try
tell application "System Events"
set tmp to home folder
set tempFile to (POSIX path of tmp) & "/tempartimage.pict"
end tell
tell application "Image Events"
set fyl to item i of arts
set img to open fyl
set dim to dimensions of img
--If both dims are larger than 1024, scale it down so the smallest is 1024:
if item 1 of dim > 1024 and item 2 of dim > 1024 then
if item 1 of dim > item 2 of dim then
set fctr to 1024.0 / (item 2 of dim)
else
set fctr to 1024.0 / (item 1 of dim)
end if
--Comment out this line and it works:
scale img by factor fctr
end if
try
save img as PICT in tempFile
on error err
tell application "Finder"
display dialog err
end tell
end try
close img
end tell
I've also submitted a bug in that the "resolution" property of class "image" is read-only. That's ridiculous! The dictionary doesn't say any of the properties are read-only, but setting them results in an error. You should be able to change the resolution of an image. It's just a number and doesn't affect pixel data.
Steve Mills
Drummer, Mac geek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden