ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 CMYK

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
pierrotsc Posted - May 11 2013 : 19:23:19
First, how do I convert an image from RGB to CMYK and then, is it possible to split it into 4 layers? I know in RGB, I can split into Red, Green and blue layers.
Thanks.
P
4   L A T E S T    R E P L I E S    (Newest First)
pierrotsc Posted - May 15 2013 : 04:08:40
in the color wheel, if you invert the red channel, you should get cyan.
So I use the proc.negative command. I'll do more testing.
PO
fab Posted - May 14 2013 : 06:56:39
Maybe it means:

C = 255 - R
M = 255 - G
Y = 255 - B

But this is very poor RGB->CMY conversion (for the K you need another step).
pierrotsc Posted - May 14 2013 : 05:14:47
Thank you..Someone told me that if I invert the RGB channels, I would get CMY

Maybe it is easier this way..
P
fab Posted - May 14 2013 : 03:52:26
You can convert the pixel format from RGB to CMYK with:

ImageEnView.LegacyBitmap := false; // tells: don't use TBitmap
ImageEnView.IEBitmap.PixelFormat := ieCMYK;

You can extract CMYK pixel with:

CMYK := ImageEnView.IEBitmap.Pixels_ieCMYK[col, row];

CMYK is typed as TCMYK.
To create 4 layers, you have to loop among all pixels:

var
  col, row: integer;
  w, h: integer;
begin
  // layer 0 (CMYK image, you can also load native CMYK image)
  ImageEnView1.LegacyBitmap := false;
  ImageEnView1.IO.LoadFromFile('input.jpg');
  ImageEnView1.IEBitmap.PixelFormat := ieCMYK;

  w := ImageEnView1.IEBitmap.Width;
  h := ImageEnView1.IEBitmap.Height;

  ImageEnView1.LayersAdd(w, h, ie8g); // layer 1 = C
  ImageEnView1.LayersAdd(w, h, ie8g); // layer 2 = C
  ImageEnView1.LayersAdd(w, h, ie8g); // layer 3 = C
  ImageEnView1.LayersAdd(w, h, ie8g); // layer 4 = C

  for row := 0 to h - 1 do
  begin
    for col := 0 to w - 1 do
    begin
      with ImageEnView1.Layers[0].Bitmap.Pixels_ieCMYK[col, row] do
      begin
        ImageEnView1.Layers[1].Bitmap.Pixels_ie8[col, row] := c;
        ImageEnView1.Layers[2].Bitmap.Pixels_ie8[col, row] := m;
        ImageEnView1.Layers[3].Bitmap.Pixels_ie8[col, row] := y;
        ImageEnView1.Layers[4].Bitmap.Pixels_ie8[col, row] := k;
      end;
    end;
  end;
  
end;