AppleScript to convert CMYK to RGB values

A couple of days ago someone asked me if I knew how to convert CMYK to RGB using AppleScript. After boring them silly with my explanation of colour models and explaining that it’s not really possible, I came up with this which is a close approximation and finally gives me something to put on my blog.

on cmykrgb(c, m, y, k)

    set r to 255 - (round (2.55 * (c + k)))
    set g to 255 - (round (2.55 * (m + k)))
    set b to 255 - (round (2.55 * (y + k)))

    if (r < 0) then set r to 0
    if (g < 0) then set g to 0
    if (b < 0) then set b to 0

    return {r, g, b}
end cmykrgb

Posted under AppleScript

This post was written by stetho on June 12, 2008

Tags: , ,

1 Comment so far

  1. Nathan April 28, 2009 1:53 am

    Hi Man,

    Thanks for this… i have been searching the internet for a formula and everyone says its too hard and complicated… but this is easy!

    I was actually looking for a solution for flash AS3 but was able to modify your code…

    Cheers ;)

Leave a Comment

Name (required)

Email (required)

Website

Comments

More Blog Post