Hello everyone! Did a search and could not find anything on the subject.
I need to convert a large set (n>3000) of RGB colours (alternatively LAB) to CMYK. I found a DHTML function (by The Noah Institute) and based on that, wrote an add-on to my CAD-program VectorWorks, using Pascal. However, the results are disappointing and colours are way off. (Resemblance is purely coincidental.) Sliders & ColorSync calculator give entirely different values.
Now I’ve been told that ColorSync is scriptable - but I don’t know AppleScript!
Can anyone perhaps give some pointers on the subject?
The source data is either tab- or comma-delimited, eg
NAME, R%, G%, B%
Output can be anything; in the end it will become a set of XML-data files, but that I can handle elsewhere, like in FileMaker Pro. The ideal output format might be
NAME, C_decimal, M_decimal, Y_decimal, K_decimal
Sample line of the final code:
0.000, 0.029, 0.108, 0.024TVT F400
Alternatively, if someone has a good conversion formula that can be modified for Pascal… But I do think ColorSync would do it better.
I was really hoping to be able to use profiles in this conversion. Or at least different schemata (perceptive, absolute etc). Calculations that I could trust.
The EasyRGB formulae seem to be identical to the failing ones I already use.
Ah well, life wasn’t supposed to be easy. (But why can’t one script the calculator? They’re just cells or something like it… Shouldn’t be that difficult…)
Because in the dictionary of ColorSyncScripting there aren’t any commands to calculate colors.
No commands → no scripting!!
Here is a long winded way with GUI scripting, but for 3000 values it would take hours
property R : "0.1234"
property G : "0.2456"
property B : "0.6789"
activate application "ColorSync Utility"
tell application "System Events"
tell process "ColorSync Utility"
click button "Calculator" of tool bar 1 of window 1
repeat until exists window "Calculator"
delay 0.5
end repeat
my set_popup("RGB", 1, 2)
delay 0.5
my set_popup("CMYK", 2, 1)
my set_RGB({R, G, B})
tell group 2 of group 1 of window 1
set MYCK to value of text fields 1 thru 4
end tell
end tell
end tell
display dialog "C: " & item 3 of MYCK & return & "M: " & item 1 of MYCK & return ¬
& "Y: " & item 2 of MYCK & return & "K: " & item 4 of MYCK & return
on set_popup(_value, _group, _popupidx)
tell application "System Events"
tell process "ColorSync Utility"
tell group _group of group 1 of window 1
tell pop up button _popupidx
if value is not _value then
click
delay 0.5
click menu item _value of menu 1
end if
end tell
end tell
end tell
end tell
end set_popup
on set_RGB(RGB)
tell application "System Events"
tell process "ColorSync Utility"
tell group 1 of group 1 of window 1
repeat with i from 1 to 3
set value of attribute "AXFocused" of text field i to true
keystroke (item i of RGB)
end repeat
end tell
end tell
end tell
end set_RGB
just thinking out of the box and total without reason but is there maybe someway to access the color sync utility through the shell ? or maybe there is a shell plugin that could be called by applescript ?