"Akua Sweets 143" addition ??? resize image ???

Did somebody know how to use “Akua Sweets 143” addition? How to resize a image with the “scale image” commande?
If you know please give me a clue,
LeMac.

it should work “scale image alias x to {200, 200}”. “expansion” may be as “crop” (but I’m not sure); and “at”, the resolution.

I’ve been experimenting with GrapicImporter OSAX for generating thumbnails and it seems to work pretty well (and it is OS X compatible). Try something like…

set theSize to giget gi size image theImageData
set X_dem to item 1 of theSize
set Y_dem to item 2 of theSize

if X_dem is greater than Y_dem then
set theBoundingRec to {0, 0, 80, round (80 * Y_dem / X_dem)}
else
set theBoundingRec to {0, 0, round (80 * X_dem / Y_dem), 80}
end if

giconvert theImageData bounds theBoundingRec type “JPEG” quality 85 resolution {72, 72}
set TheImage to result

Wow!! thanks for your reply…
But I’m not at this level of programation :frowning:
What is “GraphicImporter OSAX”, a addition?
and what is “giget gi” in “set theSize to giget gi size image theImageData”
and finaly how do I refer to m’I image, with “theImageData”? like in [set theImageData to “myimage.jpg” on desktop] ??

Sorry for m’I ignorance, and for m’I english “car, en fait: je parle francais!”

Pas de problem avec votre anglais. C’est tres bien. Beaucoup plus meilleur que mon français.

Yes, it is a scripting addition. You can find it in the scripting addition section of this site. The documentation for the addition is nil, but it is pretty easy to use. The dictionary has two commands with several setable parameters…

giget: Get information of QuickTime, an image file or a picture.
giget gi export image type list/gi import image type list/gi size/gi resolution/gi depth/gi quality – The type of getting data.
[image anything] – An image file.
Result: anything – Case by case.

giconvert: Convert an image file or a picture.
giconvert anything – an image file or a picture.
[type type class] – A format of the image which is Finder file type. default: “PICT”
[image file specification] – If this parameter is a file, then it specifies the resulting image file. If it isn’t provided, retrun result as picture.
[matrix a list of real] – A matrix for affine transformation.
[bounds bounding rectangle] – A bounds of the image.
[proportions boolean] – To keep proportions of the image.
[resolution a list of real] – A resolution of the image. ex. { 72, 72 }
[depth integer] – A depth of the image.
[quality real] – A quality of the image. range: 0-100, negative: don’t recompress, over 100: lossless .
[target size integer] – A target data size of the image.
cropping bounding rectangle – A source bounds of the image.
Result: anything – A file specification or picture.

Merci beaucoup de ta reponse :slight_smile: :stuck_out_tongue: :smiley:

95% of the script work very well but Applescript can’t convert the image with the transformation

on run
tell application “Finder”
set theImageData to file “Abstract 8.jpg”

	set theSize to giget gi size image theImageData
	set X_dem to item 1 of theSize
	set Y_dem to item 2 of theSize
	
if X_dem is greater than Y_dem then
	set theBoundingRec to {0, 0, 80, round (80 * Y_dem / X_dem)}
else
	set theBoundingRec to {0, 0, round (80 * X_dem / Y_dem), 80}
end if
giconvert theImageData bounds theBoundingRec type "JPEG" quality 85 resolution {72, 72}
set theImageData to result

end run

When I did this, I did 'nt reseave any error message but the image “Abstract 8.jpg” did not change? Why? what’s wrong with my script?

Thanks for your help, Marc.

Thanks… I find it, and it’s work…

on run
tell application “Finder”
set theImageData to file “Abstract 8.jpg”

	set theSize to giget gi size image theImageData
	set X_dem to item 1 of theSize
	set Y_dem to item 2 of theSize
end tell
if X_dem is greater than Y_dem then
	set theBoundingRec to {0, 0, 80, round (80 * Y_dem / X_dem)}
else
	set theBoundingRec to {0, 0, round (80 * X_dem / Y_dem), 80}
end if

giconvert theImageData image theImageData bounds theBoundingRec type "JPEG" quality 85 resolution {72, 72}

end run

:smiley: