Re: crop left half of image via script / iMagine Photo
Re: crop left half of image via script / iMagine Photo
- Subject: Re: crop left half of image via script / iMagine Photo
- From: email@hidden
- Date: Thu, 21 Jul 2005 14:13:49 +0100
Hi,
Some while ago, Kevin Meaney gave some helpful advice on cropping an image using iMagine Photo.
I have tried to extend this with one extra line to scale the image after it has been cropped but the result is not quite correct.
The script I am using is:
set chosenFile to choose file
tell application "iMagine Photo"
set thisImporter to import graphic chosenFile
set theprops to the properties of thisImporter
set {x, y, theWidth, theHeight} to the natural bounds of theprops
set the source rectangle of thisImporter to {8, 132, theWidth - 8, theHeight - 133} -- Crop line
set the destination rectangle of thisImporter to {0, 0, 500, 300} -- Scale line
tell thisImporter to make exporter with properties {export file type:"PNG", export folder location:path to desktop folder, expo!
rt file name:("s" & file name of theprops), export compression quality:maximum, export resolution:{72.0, 72.0}}
export thisImporter
close thisImporter
end tell
As you can see in the 'Crop line', I am cropping 8 pixels from the left and right edges, 132 pixels from the top and 133 pixels from the bottom of the image. This works fine if the following 'Scale line' is commented out.
With the 'Scale line' included, the final image is the correct size (500 x 300 pixels) but the bottom section of the image has not been cropped out, though the left, right and top edges have been cropped correctly!
I am left with 52 pixels (133 x the scaling ratio) of unwanted pixels on the bottom of the image.
I have tried all sorts of variations for the scaling command but all give the same result.
Any ideas what I'm doing wrong?
Regards,
Andrew _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden