Photoshop Save Options?

i have the following script (simplified):

on run
tell application “Finder”
set sourcePath to choose folder with prompt “Please select SOURCE folder:”
set savePath to choose folder with prompt “Please select DESTINATION folder:”
set fileList to every file of sourcePath
end tell

repeat until fileList = {}
	set FilePath to item 1 of fileList as alias
	
	tell application "Adobe Photoshop CS2"
		open FilePath
		set pathCount to count of path items of document 1
		if pathCount = 2 then
			make clipping path path item 1 of document 1 flatness 7
		end if
		
		save document 1 in FilePath as Photoshop EPS with options {class:EPS save options, encoding:medium quality JPEG, preview type:eight bit Mac OS}
		
		close document 1
	end tell
	
	set fileList to rest of fileList
end repeat

end run


the script works fine, but it is missing one capability i need – the source files will be a mixed bag of eps files saved with various save options… i want everything to be medium quality jpeg encoding, except for those files set to maximum…

there doesn’t seem to be anyway of getting the encoding or preview type of files before u save them…

does anyone know how i can access this info from the file? i looked at document properties but it was not there (i don’t think)…

try this in your script (where the Variable theFile is your FILE):


set tmpHeader to read file theFile for 1200
	set text item delimiters to "%ImageData:"
	set a to text item 2 of tmpHeader
	set text item delimiters to " \"beginimage\""
	set b to text item 1 of a
	set checkNum to last character of b
	
	if checkNum = "6" then set codecVar to "JPG-Max"

when you read a Photoshop CS2 eps file you get something like this:

%!PS-Adobe-3.0 EPSF-3.0
%%Creator: Adobe Photoshop Version 9.0x211
%%Title: 01_max.eps
%%CreationDate: 21.03.2006 8:34 Uhr
%%BoundingBox: 0 0 431 401
%%HiResBoundingBox: 0 0 430.56 401.28
%%SuppressDotGainCompensation
%ADO_ContainsXMP: MainFirst
%%EndComments
%%BeginProlog
%%EndProlog
%%BeginSetup
%%EndSetup
%ImageData: 1794 1672 8 3 0 1 6 “beginimage”
%BeginPhotoshop: 12986
% 3842494D04040000000000AC1C0200000200021C027A001052533A446967696C…

in the line:
%ImageData: 1794 1672 8 3 0 1 6 “beginimage”

the last number “6” is the value of the JPG-Level which the EPS-File was saved.

6 = EPS-JPG-Max
5 = EPS-JPG-High
4 = EPS-JPG-Med
3 = EPS-JPG-Low

just try around…

greets from
TMA

thank TMA –

i’ll get that hooked up today… i know it will work…

thanks again…

–seth

worked like a charm!! – thx

TMA, this looks interesting do you know what the other numbers are for just wondering if something like this could be used with a script to check bit depth and channels, so I could check if file needs processing with photoshop before opening them?

here the imagedata options:

example (eps/jpg-max): %ImageData: 1794 1672 8 3 0 1 6

1794: columns / Width of the image in pixels
1672: rows / Height of the image in pixels
8: depth / Number of bits per channel. Must be 1 or 8
3: mode / Bitmap/grayscale = 1; Lab = 2; RGB = 3; CMYK = 4
0: pad channels / Number of other channels stored in the file.
1: block size / Number of bytes per row per channel. Will be either 1 = Data is interleaved or formula (columns*depth+7)/8 = Data is stored in line interleaved format or there is only one channel
6: JPG-Max

(5: JPG-High
4: JPG-Med
3: JPG-Low
2: Data is in hex ascii format
1: Data is in binary/ascii format)

use on own risk!
Greets from
TMA

Thanks for that TMA it may prove useful. You have pretty much confirmed what I was thinking. It is mostly for files from our digital photography dept. Looking for 16 bit though.