• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: RGB to CMYK
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RGB to CMYK


  • Subject: Re: RGB to CMYK
  • From: Steve Thompson <email@hidden>
  • Date: Mon, 23 May 2011 01:24:08 +0100


On 22 May 2011, at 20:37, Jim Thorton wrote:

If I select the following values, the AppleScript code above gives me {224,225,120}

That code looks familiar...

When I wrote that code ( http://blog.stetho.co.uk/2008/06/12/applescript-to-convert-cmyk-to-rgb-values/ ) I tested it against http://web.forret.com/tools/color.asp amongst other things. Although Mark's explanation is spot on and the differences between additive and subtractive colour systems makes the maths difficult, it does give a reasonable approximation. I saw your email and panicked (as anyone who has been peddling the same piece of code for three years would when someone points out it doesn't work!) so I tried my code with your numbers and get a completely different result to yours (but the same result as web.forret.com).

set test to cmykrgb(0, 79, 41, 0)

Result:

{255, 54, 150}

I've quickly reviewed my calculations using your CMYK values as a reference. In your result {224,225,120} your R(ed) value is 224. The R calculation is 255 - (round (2.55 * (c + k)))  and the only values of c and k that return 224 for this sum are where c+k=12, for example c=0 & k=12, c=1 & k=11, c=2 & k=10 and so on to c=12 and k=0. As you don't have any of these pairings in your CMYK values there's no chance of values being transposed. Also, if you take your c and k values of 0 and insert them in to  "set r to 255 - (round (2.55 * (c + k)))" you get 

255 - ( round (2.55 * (0 + 0)))
= 255 - ( round (0))
= 255

Also, purely because of the way AppleScript's "round" function works (it rounds up or down to the nearest whole number) there's no way to obtain 225 using whole numbers. So there's something wrong with your copy of the cmykrgb function or the values you're passing to it aren't what you think they are.

Steve

---------------------------------
Steve Thompson
http://about.me/stetho



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >RGB to CMYK (From: Jim Thorton <email@hidden>)

  • Prev by Date: Re: RGB to CMYK
  • Next by Date: Export MS Excel range to a PDF file
  • Previous by thread: Re: RGB to CMYK
  • Next by thread: Export MS Excel range to a PDF file
  • Index(es):
    • Date
    • Thread