• 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: Changing White to Yellow on a pixel by pixel basis
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing White to Yellow on a pixel by pixel basis


  • Subject: Re: Changing White to Yellow on a pixel by pixel basis
  • From: "Jonathan Levi, M.D." <email@hidden>
  • Date: Tue, 15 Aug 2006 21:53:08 -0400

On Tue, 15 Aug 2006 09:32:49 -0400, Chris Tangora <email@hidden> wrote:
Date: Tue, 15 Aug 2006 09:32:49 -0400
I'm hoping to find a way to do some fine tuned color management and I can't find a good way to do it yet, hoping someone has a good idea.


What I'm doing right now is taking a CMYK TIFF and turning it into an RGB PNG via an external application (Binuscan). The problem is that the white background isn't truly representative of the paper we print on (newsprint). I was hoping to find some way to script color sync or image events or something else entirely that would take the 255, 255, 255 in RGB or the 0, 0, 0, 0 values in CMYK and convert them to another color, only affecting that single color though, pretty much a pixel by pixel check. Does anybody know of a built-in
apple application that can do this or any other way of doing it?

I do such pixel-by-pixel editing now and then. One venerable file format I've found useful for this kind of work is the XPM format, by Arnaud le Hors (sp?) It's human-readable; you can figure out very quickly what's being done and make simple modifications by hand, using sed, AppleScript's or Emanuel's find/replace commands, etc. Convert your graphic to XPM format using GraphicConverter, Imagemagick, etc, make your substitution, and convert back to original format.


A quick example: here's an XPM file for a 9x9 pixel graphic. The top three rows are blue, the middle three rows, red, the bottom three, white:

jonathan$ echo; cat simplePainting.xpm

/* XPM */
static char *simplePainting[] = {
/* width height ncolors chars_per_pixel */
"9 9 3 1",
/* colors */
"A c #FFFFFFFFFFFF",
"B c #FFFF00000000",
"C c #00000000FFFF",
/* pixels */
"CCCCCCCCC",
"CCCCCCCCC",
"CCCCCCCCC",
"BBBBBBBBB",
"BBBBBBBBB",
"BBBBBBBBB",
"AAAAAAAAA",
"AAAAAAAAA",
"AAAAAAAAA"};

A pale yellow color used in the Eudora mailbox icon has RGB values {255, 255, 239}; the corresponding XPM color definition is #FFFFFFFFEFEF, If you substitute this string in place of #FFFFFFFFFFF in the line

"A c #FFFFFFFFFFFF",

above, then open the XPM in GraphicConverter, etc., you'll see all the white pixels replaced by yellow pixels. A simple modification of the above would allow you to swap in a whole range of colors ikf you kept the desired color definitions in a separate cache,

One disadvantage of this method is that although the XPM format can handle arbitrarily many colors, both GraphicConverter and ImageMagick silently reduce the number of colors during conversion if there are "too many" colors (>256?) in the original. On the other hand, newsprint shouldn't require that many colors, I imagine.

HTH,

Jonathan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Regular expressions help request: source file of disk image volume
  • Next by Date: Fw: File/folder name cleanup droplet
  • Previous by thread: Re: Changing White to Yellow on a pixel by pixel basis
  • Next by thread: satimage.osax issue
  • Index(es):
    • Date
    • Thread