Using Image Capture application

I’m having difficulty getting Image Capture to open a file. I would like Image Capture to open a JPEG, and just scale the image down to another size, which I know is very much possible, based on Apple’s page at:
http://www.apple.com/applescript/image_capture/

First a question: Does Image Capture care about the original file’s type and creator? For example, I have a bunch of images I made in Photoshop. When I tell Image Capture to open this folder of images, Photoshop launches instead. I changed the images to what I hoped was a neutral type and creator (type: JPEG, creator: ogle) and this time Preview opens instead.

I’m not expecting any applications to open except Image Capture Scripting.

Any suggestions?

If your code is opening PS or Preview, most probably is wrong. Try this one instead:

set theImg to alias "path:to:image.jpg"
tell application "Image Capture Scripting"
	set x to (open theImg)
	scale x to size 250
	save x in theImg
	close x
end tell

For a more powerful set of image manipulation tools (and less buggy), visit http://www.imagemagick.org/ :wink:

Hi JJ -
Thanks for the response. That script you provided worked great. What if I wanted to repeat that command on a series of files in a folder, instead of just one file? I tried combining your code with a repeat loop that I had, but I am getting execution errors:

set imageSource to "disk1:Users:downsizing:Desktop:batch:images:"
tell application "Finder" to set imgList to get every file of folder imageSource
repeat with theImg in imgList
	tell application "Image Capture Scripting"
		set x to (open theImg)
		scale theImg to size 280
		save x in theImg
		close x
	end tell
end repeat

Any help would be greatly appreciated. Thanks again!

-Derek

Does this work?

set imageSource to "disk1:Users:downsizing:Desktop:batch:images:"
tell application "Finder" to set imgList to get every file of folder imageSource as alias list
repeat with theImg in imgList
	tell application "Image Capture Scripting"
		set x to (open theImg)
		scale x to size 280
		save x in theImg
		close x
	end tell
end repeat

– Rob

Hi Rob -

It sort of worked - I did not get the massive execution error from before, but this time I did get a parameter error.

scale alias "disk1:Users:downsizing:Desktop:batch:images:58539.jpg" to size 280
	--> Image Capture Scripting got an error: Parameter error.

The line it stopped on was:

scale theImg to size 280

Do you think it could be specific to the first image in the list it is processing, or am I still missing something in the code?

Thanks,

-Derek

I very rarely manipulate images so I don’t know what the problem might be. Maybe the script needs two size parameters.

– Rob

At least in my machine, Image Capture Scripting is a crap piece of software, and it allways stops working after processing 20 or 30 images. I develope/d a little app using it, and my most common reported bug, through an AppleScript Studio interface, was “Connection is invalid”, which usually means that you are passing the wrong data. which usually means that ICS is buggy.
If you are planning process lots of images, I still would recommend Imagemagick! :wink:

  • Or wait for the Panther…

Unless you are going to scale by percentage you need to have the width and height as integer listed in the script.

scale theImg to size {280, 280}

If you are going to test that {280, 280}, be sure to backup previously your test image…