Photoshop pixel color

Hello!

Sorry for the new topic but I spent more than hour to find the answer but no luck.
The quest is simply: How can I get and set the color of a pixel in a document? I tryed:

tell application "Adobe Photoshop CS3"
	tell current document
		select region {{0, 0}, {0, 1}, {1, 0}, {1, 1}}
		set a to color value of selection
	end tell
end tell

It’s not working. I tryed a lots of combination without any results.

Thanks.

p.s.: If the answer here, please link it! Maybe I used wrong keywords.

As of CS3 you have a colo(u)r sampler you should be able to set position then read color values. Pre that you needed to read channel histograms.

Hmmmm…

Can You write a sample?

I don’t have CS3 or CS4 so I have no way to confirm that this would even compile. I only got the manual as PDF to see what was new.
The position of the sampler is read only so it looks like you need to script making a new one then read that.

tell application "Adobe Photoshop CS3"
	tell current document
	set My_Sampler to make new color sampler at beginning with properties {class:color sampler, positon:{100, 100}}
	set My_Values to color sample color of color sampler 1
	end
end tell

Thank You!!

I modified a little:

tell application "Adobe Photoshop CS3"
	tell current document
		set My_Sampler to make new color sampler with properties {class:color sampler, position:{10, 10}}
		set My_Values to color sampler color of My_Sampler
		delete My_Sampler
	end tell
end tell

“delete My_Sampler” because the max. samplers is 4.

what about CS2 ??

For CS2 you need to create a 1 pixel selection as in the first post then read the histogram for each of your channels looking for the value of 1 in the 256 item list (that is if you image is 8 bits per channel) what colour space is your image? Do you need RGB as 0-255 or CMYK as %

After reading your reply about histogram and channels, i found this : http://macscripter.net/viewtopic.php?id=27532

I’ll try the CMYK_Values function shows in that topic.

Thank you for your fast reply !

Does anybody know how to adjust the sample size of the eye dropper, which is also used by the color sampler?