Batch Photoshop pict>jpeg Conversion?

I’m very new to AppleScript, in the sense that I gave it a shot a while ago and immediatly discovered that I couldn’t make it do what I wanted without some serious research (namely, enable internet sharing without waiting for system prefs and then the sharing panel to load).

My problem is I’ve got 150+ photos that I retouched, cropped, and resized in Photoshop. However, I saved them all as picts - and in order to make a cross-platform CD and put them on the internet, I need to convert them all to jpeg. I’ve found that other batch processing utilities decide to throw out three quarters of the picture data for no reason (Preview does this too) and give me a poorly scaled 300x400 pixel rendition of the original 1152x768 image. So my only recourse is to script Photoshop, which I can’t figure out how to do. I can make an action that’ll do what I want (I think) on one specific image, but not work in general on a whole folder of them. And the dictionary command in the Script Editor is only a little more helpful than the “man” command in the unix terminal… meaning hardly helpful to a beginner at all.

I hope I’m posting this in the right place… I found the link in MacAddict. Any assistance would be appreciated.

You don’t want to involve Applescript. You need to do a Batch Action in Photoshop. First, make an action which does what you want on a test image.

Then go to File>Automate>Batch Action. It can be a little tricky at first. The clue is to include closing the image and saving it as part of the action. Then in the Batch Action options, choose “Save & close”.

Photoshop’s Help will guide you, or these sites:

http://www.rogercavanagh.com/actions/04_fileauto.htm
http://www.rogercavanagh.com/actions/10_batch_action.htm

Thomas S. England
Decatur GA 30030
Photojournalism Portfolio:
http://englandphoto.com/portfolio//

This chunk of code opens a folder of images, saves them as JPG’s, then duplicates the JPG’s to a third folder. Resizing them at the same time will be easy to do, you should grab the Adobe Photoshop scripting guide from: http://partners.adobe.com/asn/photoshop/scripting.jsp otherwise you can jump to various Adobe scripting links from my site at: http://iolaire.mine.nu/current_site/adobe.php.
Good luck,
iolaire

-- Base code from Photoshop Scripting 1.0.2a:Sample Scripts:AppleScript:Batch Convert
-- i.e. on the install disk for scripting

-- set the folders that you want to use
set inputFolder to "Macintosh_OS_X:Users:iolaire:Desktop:DCIM:Flood_A:"
set outputFolder to "Macintosh_OS_X:Users:iolaire:Desktop:DCIM:Flood_B:"
set copyFoldername to "Macintosh_OS_X:Users:iolaire:Desktop:DCIM:Flood_C:"

tell application "Finder"
	set filesList to files in folder inputFolder
end tell

tell application "Adobe Photoshop 7.0"
	set display dialogs to never
	close every document saving no
end tell

repeat with aFile in filesList
	set fileIndex to 0
	tell application "Finder"
		-- The step below is important because the 'aFile' reference as returned by
		-- Finder associates the file with Finder and not Photoshop. By converting
		-- the reference below 'as alias', the reference used by 'open' will be
		-- correctly handled by Photoshop rather than Finder.
		set theFile to aFile as alias
		set theFileName to name of theFile
	end tell
	tell application "Adobe Photoshop 7.0"
		open theFile
		set docRef to the current document
		-- Convert the document to a document mode that supports saving as jpeg
		if (mode of docRef is not RGB) then
			change mode docRef to RGB
		end if
		-- The first copy is simply saved with additional document info added
		set infoRef to get info of docRef
		set docName to name of docRef
		set docBaseName to getBaseName(docName) of me
		set fileIndex to fileIndex + 1
		set newFileName to (outputFolder as string) & docBaseName
		save docRef in file newFileName as JPEG appending lowercase extension with copying
		set fileIndex to fileIndex + 1
		set newFileName to (outputFolder as string) & docBaseName
		save docRef in file newFileName as JPEG appending lowercase extension with copying
		close current document without saving
	end tell
	tell application "Finder"
		duplicate the file theFileName of folder inputFolder to the folder copyFoldername replacing yes
	end tell
end repeat


-- Returns the document name without extension (if present)
on getBaseName(fName)
	set baseName to fName
	repeat with idx from 1 to (length of fName)
		if (item idx of fName = ".") then
			set baseName to (items 1 thru (idx - 1) of fName) as string
			exit repeat
		end if
	end repeat
	return baseName
end getBaseName

Many thanks; the Photoshop technique worked great and was pretty much painless.