How to turn off color management for a document from a script?
Hello. I am running an old script that worked fine in CS2. But now in CS4, it messes up. The script generates an image, and inserts certain codes into certain pixel's RGB values for later processing by my own C program. For example, it should write a color value of 014B96, but instead it plays with the value first, and writes 024C96 . I don't know why it plays with the value, but I guess it could be related to the color management. After creating a new document, I try to disable the color management with doc.colorProfileType = ColorProfile.NONE, but when it executes that line, it says "User cancelled the operation".
I've made a simple minimal test script to illustrate what I'm talking about. In the test script, it tries to draw a 10x10 block of 014B96, but it ends up being 024C96 for some strange reason. The offending lines are commented out. Please tell me what I am doing wrong! Thanks!
----------
#target photoshop
var doc = documents.add(
90,
90,
72.0,
"Test",
NewDocumentMode.RGB,
DocumentFill.BACKGROUNDCOLOR
);
//The following yields the error "User cancelled the operation":
//doc.colorProfileType = ColorProfile.NONE;
//The following yields the error "ColorProfileType is undefined.":
//doc.colorProfileType = ColorProfileType.NONE;
var color = new SolidColor;
color.model = ColorModel.RGB;
color.rgb.red = 1;
color.rgb.green = 75;
color.rgb.blue = 150;
var x = 5;
var y = 5;
var size = 10;
doc.selection.select ( Array (
Array ( x, y ),
Array ( x+size, y ),
Array ( x+size, y+size ),
Array ( x, y+size ),
Array ( x, y )
) );
doc.selection.fill ( color, ColorBlendMode.NORMAL, 100 );
doc.selection.deselect ();
