Convert Colorspace using profile "sRGB IE61966-2.1"

Hi there,

I already have a script that converts EPS files to Jpg’s and changes the color mode.
What I want to add is:
Change the colorspace to RGB using “sRGB IE61966-2.1”.
The input file can be CMYK (any CMYK to sRGB IE61966-2.1) or RGB (any RGB to sRGB IE61966-2.1).

Any help is greatly appreciated!!

–Peter–

Here is my script so far (Many thanks Mark27!!!):

set Input_Folder to choose folder with prompt "Kies een map met RGB beelden" without invisibles
--
tell application "Finder"
	if not (exists folder "LAY_OUT" of Input_Folder) then
		set x to make new folder at Input_Folder with properties {name:"LAY_OUT"}
		set EPS_Folder to x as text
	else
		set EPS_Folder to folder "LAY_OUT" of Input_Folder as text
	end if
	if not (exists folder "JPEG_OUT" of Input_Folder) then
		set y to make new folder at Input_Folder with properties {name:"JPEG_OUT"}
		set JPEG_Folder to y as text
	else
		set JPEG_Folder to folder "JPEG_OUT" of folder Input_Folder as text
	end if
	set File_List to files in Input_Folder
end tell
--
tell application "Adobe Photoshop CS3"
	set display dialogs to never
	set User_Rulers to ruler units of settings
	set ruler units of settings to pixel units
end tell
--
repeat with This_File in File_List
	tell application "Finder"
		set The_File to This_File as alias
	end tell
	tell application "Adobe Photoshop CS3"
		activate
		open The_File
		set Doc_Ref to the current document
		tell Doc_Ref
			set Doc_Name to name
			set Base_Name to my getBaseName(Doc_Name)
			if (bits per channel is sixteen) then
				set bits per channel to eight
			end if
			if (mode is not RGB) then
				set Colour_Space to mode
				change mode to RGB
			end if
			resize image resolution 72 resample method bicubic
			set Saved_State_1 to current history state
			set New_Path to EPS_Folder & Base_Name & ".eps.lay"
			save Doc_Ref in file New_Path as Photoshop EPS with options {class:EPS save options, embed color profile:false, encoding:medium quality JPEG, preview type:eight bit TIFF} appending no extension with copying
			set current history state to Saved_State_1
			if exists path item "Pad 1" then
				create selection path item "Pad 1" feather amount 0 with antialiasing
				invert selection
				fill selection with contents {class:RGB color, red:255, green:255, blue:255}
				deselect
			else
				if exists path item "Pad 1 kopie" then
					create selection path item "Pad 1 kopie" feather amount 0 with antialiasing
					invert selection
					fill selection with contents {class:RGB color, red:255, green:255, blue:255}
					deselect
				end if
			end if
			set Pixel_Height to height
			set Saved_State_2 to current history state
			set New_Path to JPEG_Folder & Base_Name & "_100.jpg"
			save Doc_Ref in file New_Path as JPEG with options {quality:6, embed color profile:false} with copying
			set current history state to Saved_State_2
			resize image height Pixel_Height / 2 resolution 72
			set New_Path to JPEG_Folder & Base_Name & "_50.jpg"
			save Doc_Ref in file New_Path as JPEG with options {quality:6, embed color profile:false} with copying
			set current history state to Saved_State_2
			resize image height Pixel_Height / 4 resolution 72
			set New_Path to JPEG_Folder & Base_Name & "_25.jpg"
			save Doc_Ref in file New_Path as JPEG with options {quality:6, embed color profile:false} with copying
			close without saving
		end tell
	end tell
end repeat
end

--
tell application "Adobe Photoshop CS3"
	set ruler units of settings to User_Rulers
end tell
--
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

display dialog "Beelden zijn verwerkt" buttons {"OK"} default button 1


Hi,

is this sufficient?


.
if (mode is not RGB) then
	set Colour_Space to mode
	change mode to RGB
end if
set color profile name to "sRGB IEC61966-2.1"
resize image resolution 72 resample method bicubic
.

Hi Stefan,

Does this actually convert the file to RGB using sRGB IE61966-2.1 or does it just assign the profile to the file?

Sorry, I don’t know, there is also a convert command in the dictionary

After converting images that are not RGB to RGB this should apply your desired profile.

		if color profile kind = none or color profile name ≠ "sRGB IEC61966-2.1" then
			set color profile name to "sRGB IEC61966-2.1"
		end if

BTW convert to profile would look like this.

tell application "Adobe Photoshop CS2"
	activate
	set Doc_Ref to the current document
	tell Doc_Ref
		convert to profile "sRGB IEC61966-2.1" intent absolute colorimetric with blackpoint compensation and dithering
	end tell
end tell

But this will recalculate the numeric colour values of your image (I just assign)

Thanks Mark!!
That’s exactly what I needed!!!