Page 1 of 2

Issue with composite -stereo on 6.7.8

Posted: 2017-11-29T08:25:56-07:00
by GPI
Hello,

I am currently trying to figure out an issue I encounter when using the "composite -stereo" command.

The goal is to merge 2 grayscale tiff files into one where one of the image is in one color while the other is in a different color. It will help me to easily find out the discrepancies between the two images.

On a server, I have ImageMagick 6.2.8 installed and the command below is working fine.
composite -stereo one.tif two.tif output.tif
Output.tif is the resulting image with color so the discrepancy are immediately visible.

On a new RedHat 7 server with ImageMagick 6.7.8 installed the command below is generating only a gray scale image.
composite -stereo 0 one.tif two.tif output.tif
The two images are displayed but since only in gray color, it is harder to tell the différences between both.

The application 6.2.8 installed on the RH7 server provide proper results but since I had to find the rpm (and dependencies) on a third party website, I cannot fully trust the application.
Sources of application 6.2.8 found on the Sourceforge website do not compile on the target server.

Could you please let me know whether this is a known issue or is it by design ? Is there a work around I could use with v6.7.8 to get a colored anaglyph from two grayscale tif ?

Many thanks in advance for your help.

Re: Issue with composite -stereo on 6.7.8

Posted: 2017-11-29T09:07:39-07:00
by snibgo
If you link to one.tif and two.tif, we can test it.

Perhaps the problem is that recent IM converts the output to the colorspace of the first input. As the input is gray, it will be in grayspace, so perhaps IM makes the output the same. The cure may be "-colorspace sRGB" after the inputs.

Re: Issue with composite -stereo on 6.7.8

Posted: 2017-11-29T09:50:44-07:00
by GPI
Thanks for your feedback. I have tried to add the option "-colorspace sRGB" without success.

The files have been uploaded on the link below: https://www.sendspace.com/file/6zz8r3

There is file one and two along with the result when the command is used with v6.2.8 and with v6.7.8.

Re: Issue with composite -stereo on 6.7.8

Posted: 2017-11-29T10:46:49-07:00
by fmw42
composite is a very old and limited tool. You might be better off using the more flexible convert ... -stereo syntax so that you can add -colorspace sRGB and other commands as well as parenthesis processing. See http://www.imagemagick.org/script/comma ... php#stereo

Re: Issue with composite -stereo on 6.7.8

Posted: 2017-11-29T12:04:36-07:00
by GPI
Thanks for your help as well. The option "-stereo" is the one I am trying to use but it does no seem to be an option for the "convert" command.

When I try, I get a message "convert: unrecognized option `-stereo' @ error/convert.c/ConvertImageCommand/2761"

Re: Issue with composite -stereo on 6.7.8

Posted: 2017-11-29T13:38:55-07:00
by fmw42
You are correct. I get the same message. So the documentation at http://www.imagemagick.org/script/comma ... ptions.php for -stereo needs to be modified to say that it is a composite option, unless there is a bug and it should work for convert.

In the mean time, you can use convert to process your two input image to change them to -colorspace sRGB and pipe to composite:

Code: Select all

convert image1 image2 -colorspace sRGB MIFF:- | composite -stereo +10+0 - stereoimage
There is probably no compose equivalent to stereo for convert, since I do not see it listed at http://www.imagemagick.org/script/compose.php

Re: Issue with composite -stereo on 6.7.8

Posted: 2017-11-30T01:16:22-07:00
by GPI
Thanks for the lead.
However, it produce the same result as the command "composite -stereo 0 image1 image2 stereoimage", meaning a black and white tiff file.

Re: Issue with composite -stereo on 6.7.8

Posted: 2017-11-30T03:56:37-07:00
by GPI
After some more tries, I found that using a .jpg file instead of a .tif file as the output is working fine.

So the command below is giving me the proper result with a colored jpg image:

Code: Select all

composite -stereo 0 one.tif two.tif output.jpg
I will see how it fits with the other parts of my environment and close the topic if the modification is acceptable.

Re: Issue with composite -stereo on 6.7.8

Posted: 2017-11-30T10:41:30-07:00
by fmw42
This works fine for me on IM 6.9.9.24 Q16 Mac OSX.

Code: Select all

composite -stereo +10+0 logo: logo: logo.tif
So it might be an issue with your old version of ImageMagick.

Re: Issue with composite -stereo on 6.7.8

Posted: 2017-11-30T13:14:58-07:00
by GPI
Just installed v6.9.9-24 on my CentOS but still no luck with my files.

With the logo: as a source, I agree that it works fine. Difference would be that the colorspace of the logo: is sRGB while the one from my tif files is Gray.

I believe that using .jpg as the type of the result file will work for me so I will probably leave it this way.

No sure if I should change the title as "solved" however since the original issue remain :) I'll come back from time to time to see if an answer comes up and close the ticket once the file sharing link above has expired.

Re: Issue with composite -stereo on 6.7.8

Posted: 2017-11-30T15:28:53-07:00
by fmw42
This works fine for me on IM 6.9.9.24 Q16 Mac OSX.

Code: Select all

convert logo: -colorspace gray logog.tif
composite -stereo +10+0 logog.tif logog.tif result.tif
Perhaps you should post your two input tif images. If the tif files have transparency or multipage or multilayer, then that might be the cause of your issue.

Re: Issue with composite -stereo on 6.7.8

Posted: 2017-12-01T07:28:39-07:00
by GPI
Please find below a link to one of the file I am using.

https://www.sendspace.com/file/6zz8r3

The issue can be reproduced using the command:

Code: Select all

composite -stereo +20+0 one.tif one.tif result.tif

Re: Issue with composite -stereo on 6.7.8

Posted: 2017-12-01T10:49:26-07:00
by fmw42
This could be considered a bug.

The problem is that you have a bilevel (black/white) image. The stereo command works, but keeps the output as grayscale. You need to convert to grayscale or color first. This works for me on IM 6.9.9.25 Q16 Mac OSX.

Code: Select all

convert -quiet one.tif one.tif -type truecolor miff:- | composite -stereo +20+0 - result.tif
as does

Code: Select all

convert -quiet one.tif one.tif -type grayscale miff:- | composite -stereo +20+0 - result.tif

Re: Issue with composite -stereo on 6.7.8

Posted: 2017-12-02T02:38:54-07:00
by GPI
Many thanks for your help. While the commands do not work with the default CentOS/RHEL 7 version 6.7.8, it works fine with version 6.9.9.24.

At least I can compile the official version of ImageMagick and use this one instead.

Thanks for the time you took to answer my query.

Re: Issue with composite -stereo on 6.7.8

Posted: 2017-12-02T09:13:38-07:00
by magick
Add -compress none to your command-line. In the mean-time we'll add a patch to fix the problem you reported.