Combine 4 grayscale images into a final CMYK image
Combine 4 grayscale images into a final CMYK image
Hello Everyone.
Lemme explain my scenario.
I have an old software, that takes 4 tiff images (grayscale), and combine them into a final CMYK colored image.
I already know that each one of those images, corresponds to one color channel
ex:
image 1 - foo(c).TIFF
image 2 - foo(m).TIFF
and so goes on.
I would like to know if, can MagickNET do this kind of merging to create a final file ?
There's no documentation or anything in the old source code.
Here's my tought:
Loop into each image pixel, store and later combine in a final image (something like that) ?
Thanks in advance for any input\help.
Lemme explain my scenario.
I have an old software, that takes 4 tiff images (grayscale), and combine them into a final CMYK colored image.
I already know that each one of those images, corresponds to one color channel
ex:
image 1 - foo(c).TIFF
image 2 - foo(m).TIFF
and so goes on.
I would like to know if, can MagickNET do this kind of merging to create a final file ?
There's no documentation or anything in the old source code.
Here's my tought:
Loop into each image pixel, store and later combine in a final image (something like that) ?
Thanks in advance for any input\help.
Re: Combine 4 grayscale images into a final CMYK image
You could use the Combine method of the MagickImageCollection for this. Only have a phone atm so I cannot easily create an example for you.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Combine 4 grayscale images into a final CMYK image
At the command line, you can do this:
Sorry, I don't know Magick.NET.
Code: Select all
convert foo(c).TIFF foo(m).TIFF foo(y).TIFF foo(k).TIFF -set colorspace CMYK -combine +write info: out.tiff
snibgo's IM pages: im.snibgo.com
Re: Combine 4 grayscale images into a final CMYK image
This method works for RGB output only, as i could see. It has no mentions to a CMYK combining.
The input is 4 files, output will be one file. Unless there's some way to convert from CMYK to RGB and then combine, it won't work.
Re: Combine 4 grayscale images into a final CMYK image
What happens when you set the ColorSpace of the image to CMYK afterwards?
Re: Combine 4 grayscale images into a final CMYK image
Here's the tests i've done.
Using MagickCollection (MagickNET)
Neither the combine or mosaic worked. They all created a grayscale output anyway (and i need a colored output).
Using the command-line version, gives a few errors but create a weird output. I've uploaded the correct sample and the output i got.
Correct:
http://imgur.com/fyZEMLW
My current output:
http://imgur.com/WLh4KQc
If i set the colorspace to CMYK or RGB (while doing convert), here's the output:
http://imgur.com/8qsmEJr
Any help is appreciated. Kinda lost on this, since i'm new to image processing.
Thanks in advance.
Using MagickCollection (MagickNET)
Code: Select all
using (MagickImageCollection images = new MagickImageCollection())
{
// Add the first image
MagickImage first = new MagickImage(@"C:\DI_PLOT\Bitmaps\8FILES_IMPOSED_4UP_BACK.PDF (C)00.TIF");
images.Add(first);
// Add the first image
MagickImage second = new MagickImage(@"C:\DI_PLOT\Bitmaps\8FILES_IMPOSED_4UP_BACK.PDF (M)00.TIF");
images.Add(second);
// Add the first image
MagickImage third = new MagickImage(@"C:\DI_PLOT\Bitmaps\8FILES_IMPOSED_4UP_BACK.PDF (Y)00.TIF");
images.Add(third);
// Add the first image
MagickImage fourth = new MagickImage(@"C:\DI_PLOT\Bitmaps\8FILES_IMPOSED_4UP_BACK.PDF (C)00.TIF");
images.Add(fourth);
images.Combine();
images.Write(@"C:\DI_PLOT\finalmerge.png");
/*
// Create a mosaic from both images
using (MagickImage result = images.Mosaic())
{
// Save the result
result.Write(@"C:\DI_PLOT\finalmerge.png");
}
*/
}
Using the command-line version, gives a few errors but create a weird output. I've uploaded the correct sample and the output i got.
Correct:
http://imgur.com/fyZEMLW
My current output:
http://imgur.com/WLh4KQc
If i set the colorspace to CMYK or RGB (while doing convert), here's the output:
http://imgur.com/8qsmEJr
Any help is appreciated. Kinda lost on this, since i'm new to image processing.
Thanks in advance.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Combine 4 grayscale images into a final CMYK image
It does not look like you changed the colorspace to CMYK per dlemstra's suggestion. I do not use Magick.NET, but as a quick test, try negating the image (command line equivalent is -negate). If that is close then you need to do what dlemstra suggests.
Re: Combine 4 grayscale images into a final CMYK image
But i did
The entire command is:
convert c.tif m.tif y.tif k.tif -set colorspace CMYK -combine + write output.tif
For now i'm using command line to achieve this result. When i get command line working, i'll think on how can i implement it using MagickNET
Edit: got this version right now.
http://imgur.com/qPDXgmQ
And using negate:
http://imgur.com/vC0tFgn
Seems like the image is missing "brightness" or something (since i can see RGB colors on the left)
With negate i got really vivid colors but it still seems i'm missing some kind of brightness .
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Combine 4 grayscale images into a final CMYK image
Sorry, your code was Magick.NET. So I only thought you were asking about that. I think the proper command line would be
You do not need the +write (which should not have any spaces)
Code: Select all
convert c.tif m.tif y.tif k.tif -set colorspace sRGB -combine -colorspace CMYK output.tif
You do not need the +write (which should not have any spaces)
Re: Combine 4 grayscale images into a final CMYK image
Got it done.
I was looking this thread:
viewtopic.php?t=21159
Then i saw an sample command:
convert imgC imgM imgY imgK -set colorspace CMYK -negate -combine output_image
Should've set the colorspace to CMYK and negate also. Output is fine now.
However, now i'll check how to add some spot colors to this CMYK image.
And later, how to convert all of this to MagickNET (if possible).
The suggestion a guy gave eariler (MagickCollection) didn't worked (produced an black output). I believe i'll try to do a few more things.
Thanks !!!
I was looking this thread:
viewtopic.php?t=21159
Then i saw an sample command:
convert imgC imgM imgY imgK -set colorspace CMYK -negate -combine output_image
Should've set the colorspace to CMYK and negate also. Output is fine now.
However, now i'll check how to add some spot colors to this CMYK image.
And later, how to convert all of this to MagickNET (if possible).
The suggestion a guy gave eariler (MagickCollection) didn't worked (produced an black output). I believe i'll try to do a few more things.
Thanks !!!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Combine 4 grayscale images into a final CMYK image
IM does not support spot colors as far as I know.
Re: Combine 4 grayscale images into a final CMYK image
And if i add it as a new color ?
Ex: i have color X
It is composed by:
0% cyan
10% magenta
60% yellow
0% black
How would i combine an image with this color composition (and a white background) into my existant CMYK image ?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Combine 4 grayscale images into a final CMYK image
A "spot color" means a colour in used in a product that isn't made by combining CMYK inks. Instead, another plate is used with an ink of that colour.
IM can't add spot colors, but I don't think you want to add a spot colour.
IM can't add spot colors, but I don't think you want to add a spot colour.
snibgo's IM pages: im.snibgo.com
Re: Combine 4 grayscale images into a final CMYK image
Okay. So i got it wrong.
The color i want to add, is composed by this amount on each channel.
Like i mentioned before:
0% cyan
10% magenta
60% yellow
0% black
The image color is Grayscale and when combining it to a CMYK image, this is the color the image should have.
I supposed it would be like convert the image to CMYK assigning these channels (amount of each one), and then combine with the final CMYK image ?
The color i want to add, is composed by this amount on each channel.
Like i mentioned before:
0% cyan
10% magenta
60% yellow
0% black
The image color is Grayscale and when combining it to a CMYK image, this is the color the image should have.
I supposed it would be like convert the image to CMYK assigning these channels (amount of each one), and then combine with the final CMYK image ?