Combining multichannel images

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
annaTT
Posts: 7
Joined: 2012-06-05T07:13:41-07:00
Authentication code: 13

Combining multichannel images

Post by annaTT »

Hi, I would like to know if it exists any functionality of ImageMagick to help me with my problem. I have a multichannel image (CMYK + other channels like spot color channels) properly separated into single images. This is, now I have an image for each CMYK channel plus an image for each extra channel. I would like to know if there is any way to make the opposite process. I mean, recover my original CMYK image with the extra channels from my collection of separated images. I've been able to make it with a normal CMYK image with

Code: Select all

convert imgC imgM imgY imgK -set colorspace CMYK -negate -combine output_image
but doing the same with my multichannel image

Code: Select all

convert imgC imgM imgY imgK img1 img2 -set colorspace CMYK -negate -combine output_image
generates a CMYK image with the extra channels mixed with the CMYK ones, losing them. I haven't found any other colorspace to assign which would make what I want. Another alternative I had thought is joining just the CMYK images and add the other channels later, but I don't know if that's even possible....
If someone can help me I would be really grateful. Thank you anyway.
Anna
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combining multichannel images

Post by fmw42 »

My understanding is that IM 6 can only have at max 5 channels, cmyk and alpha. But the IM 7 alpha development that is ongoing will allow any number of channels for input or output. But note it is only in alpha development.
annaTT
Posts: 7
Joined: 2012-06-05T07:13:41-07:00
Authentication code: 13

Re: Combining multichannel images

Post by annaTT »

OK, then. Do you know when the new version is coming out?

Thank you!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combining multichannel images

Post by fmw42 »

It is just in alpha development. I don't have any idea when it will be officially released. The IM developers would have to comment, but I don't think they even know when it will be finished.

Perhaps one of them will answer and let you know if the development is far enough along and whether the alpha is available for users to try, but I am sure there are no guarantees at this point.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Combining multichannel images

Post by magick »

ImageMagick-7.0.0 most likely won't be released until 2014. However, users can download and use it now. We could use feedback to help guide its development.
annaTT
Posts: 7
Joined: 2012-06-05T07:13:41-07:00
Authentication code: 13

Re: Combining multichannel images

Post by annaTT »

Hi,
I've just tried to install the alpha 7.0.0 version, but I'm having some problems. First, the links in http://www.imagemagick.org/ImageMagick- ... hp#windows are not working. So I've downloaded the file "ImageMagick-7.0.0-0-windows.zip" from one of the mirrors in http://www.imagemagick.org/ImageMagick- ... wnload.php. I'm following the "ImageMagick Advanced Windows Installation" (http://www.imagemagick.org/ImageMagick- ... lation.php). In the Build step I'm getting some errors in the "xtrn.c" and "NtMagickView.cpp", but it seems it doesn't affect the generation of the program, as the exes for "magick" and the other commands are correctly generated in the bin directory of the installation and they seem to work fine. I'm making some tests to check them.
In any case, are there any exemples of the use of the new version regarding the multichannel processing?

Thank you,
Anna
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Combining multichannel images

Post by anthony »

No examples as of yet, as soon as I have completed basic IMv7 shell API changes, I'll be starting on IMv7 for of IM examples. Sorry I can't help much with compiling IMv7 under windows as I am a UNIX expert and linux user.


Windows is a 32 bit patch to a 16 bit GUI based on a 8 bit
operating system written for a 4 bit processor by a 2 bit
company which can not stand 1 bit of competition.

(well at least that is changing, now)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combining multichannel images

Post by fmw42 »

The only information that I know is at http://imagemagick.org/script/porting.php#cli

see -channel-fx expression

also a bit more detail at

http://magick.imagemagick.org/ImageMagi ... channel-fx

But I do not know how current or relevant this information is to your issue.

I also don't know of any testing at this time with more that 5 channels, e.g CMYKA.

It may just be too premature to start with IM 7 alpha at this time, i.e. the development is only beginning and only limited functionality with regard to many channels. Though the IM developers would have to comment. But as they said above, you can try it and let them know what problems you encounter.

Sorry I don't know anything about installation on Windows.
Last edited by fmw42 on 2012-06-12T18:09:13-07:00, edited 1 time in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Combining multichannel images

Post by anthony »

As mentioned, IMv7 low level core functions have only been created, and tested. The -channel-fx is currently the only shell access to this low level channel merging. You would use numbers such as 10, 11, 12 etc for the extra channels.

Whether specific coders can write multiple channels is still anyones guess. but unless someone tries and reports in the Bugs forum what they can get working or not with multi-channel images it will be hard to proceed.

Be warned alpha development can mean things break, especially direct download from the SVN, those SVN is recommended if helping with bug fixing.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
annaTT
Posts: 7
Joined: 2012-06-05T07:13:41-07:00
Authentication code: 13

Re: Combining multichannel images

Post by annaTT »

Hi,
Thank you for your replies. I've tried with the following command:

Code: Select all

magick imgC imgM imgY imgK img1 -channel-fx "gray=>cyan | gray=>magenta | gray=>yellow | gray=>black | gray=>10" output_image
but the result is a combined CMYK image where the extra channel has been ignored....
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Combining multichannel images

Post by anthony »

The extra channel was probably added, but the colorspace would still be 'RGB' and the output image format may not know how to handle the extra channel, and only output RGB channels.

Anyone know what image file formats understand extra channels? -- What about MIFF? It definably needs to understand extra channels, though what format changes are needed is another matter.

These are difficulties that need to be looked at in IMv7.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combining multichannel images

Post by fmw42 »

I am not sure there are any "common" image formats that support multispectral data. Possibly geotiff or matlab or Erdas or ESRI or ArcGIS formats? The most frequently used images come from SPOT and Landsat and have their own format, usually some header and optional formats that are band-by-band or band-interleave-by-line.

See for example

https://engineering.purdue.edu/~biehl/M ... cise_5.pdf
http://help.arcgis.com/en/arcgisdesktop ... 0010000000

So at this point, miff would have to store the data in its own multispectral format to be able to put more than 5 or 6 channels together.

Common processing of multispectral data involves things like classification, principal components analysis and vector processing, which means look at each pixel as a vector of channels. Thus the channels don't have to represent wavelength, but can be anything such as texture measures or other properties.

see
https://engineering.purdue.edu/~biehl/M ... rials.html
Last edited by fmw42 on 2012-06-13T19:49:31-07:00, edited 5 times in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Combining multichannel images

Post by anthony »

I know that TIFF does support extra masks, but these I think are handled more like extra images rather than extra channels.

Of course Does MIFF now understand multi-channel images?

Specifically say an image with a channel '10' added
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combining multichannel images

Post by fmw42 »

I think that mostly one could use any format that stored frames or layers to hold the channel data, such as tiff. This way one can then select which 3 layers to use to combine into an RGB image for display purposes. The layers can be processed by any common command. The only difference is that one cannot process the layers as vectors and do things like classification and principal components analysis. But for the purpose of holding all the desired channels in one image, they could just be kept as layers/frames.

I don't really know much about FITS except it is a scientific format. So perhaps it might be able to hold multispectral channels.
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Combining multichannel images

Post by whugemann »

Anthony asked me to comment on this -- probably because I'm a Windows user. Well, I never tried to compile IM myself and if I would do, I would rather start with the current release version instead of compiling an alpha version ...

Anyway, having some experience in printing, I don't see where the start question is leading: AFAIK, there is no common image format that supports more than 5 channels, so each spot color is generally supplied as a separate image, as has been stated in the original question. If you want to join these extra images with the CMYK one, you would have to assign an equivalent CMYK colour to the spot colour and then join them with the CMYK part.

It would be of help, if AnnaTT would explain what she is trying to achieve with the operation.
Wolfgang Hugemann
Post Reply