Composite: Differences in defaults/transparency between v6 and v7? [Solved]

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?".
Post Reply
bungle
Posts: 7
Joined: 2015-02-06T16:50:38-07:00
Authentication code: 6789

Composite: Differences in defaults/transparency between v6 and v7? [Solved]

Post by bungle »

I am developing an application that composes multiple images over a background. The images are supplied to me and are CMYK 8/1-bit TIFFs. I am generating two test images using the following commands:

Code: Select all

set path=d:\programs\ImageMagick-6.9.0-4
composite "Can 3x2Sign Price.tif" "Can 3x2Sign.tif" -geometry +21+175 im.tif
set path=d:\programs\ImageMagick-7.0.0-Q16
composite "Can 3x2Sign Price.tif" "Can 3x2Sign.tif" -geometry +21+175 im7.tif
I'm using the same command with both versions, but the output between v6 and v7 is different. In particular, the anti-aliasing/transparency in the original "Price" file are not being respected, leaving the output looking jagged. Here are two images that show what I mean.

Image
This has three parts. From top to bottom: 1) a small detail from the original overlay, which is "$ 2.99" in black anti-aliased on a transparent background; 2) the composite output from IM 6.9.0; 3) the composite output from IM 7. (You'll have to zoom in to see fine detail.)

Image
The second image shows another detail from the output, with v6 on top and v7 on bottom.

As you can see in my command lines, I have not done anything differently other than change versions. (IM 7 reports its version as Version: ImageMagick 7.0.0-0 Q16 x64 2015-01-09). Is this a bug, or just some change in defaults between the versions? If it is some change in defaults, what can I do to get the same output in IM 7?

(The reason I'm even looking at IM 7 is because this project really uses Magick.NET, which links in version 7. I reverted to trying my example using straight-up command-line ImageMagick so I could determine where the discrepancy was coming from, and it appears to be IM, not Magick.NET. I spent a lot of time trying different options and reading up on the different compose options, but I have found nothing so far.)

EDIT: Mark subject solved
Last edited by bungle on 2015-02-09T14:03:24-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Composite: Differences in defaults/transparency between v6 and v7?

Post by fmw42 »

IM 7 is not fully beta tested. I am slowly doing that and reporting errors. It is also HDRI enabled by default, which can cause differences. Composite is probably deprecated in favor of

IM 7

Code: Select all

magick image1 image2 -compose XXX -composite result 
IM 6

Code: Select all

convert image1 image2 -compose XXX -composite result 

and has a better chance of working. Although it does not mention composite, I suspect it has been deprecated and is not properly supported or buggy. see http://imagemagick.org/script/porting.php#cli

See also
http://www.imagemagick.org/Usage/compose/#compose

The Magic.Net developer (dlemstra) can give you more details about composite.

It could also be the IM 7 tiff reader issue. Have you tried using PNG images? Do they have the same issue?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Composite: Differences in defaults/transparency between v6 and v7?

Post by dlemstra »

Can you add some links to "Can 3x2Sign Price.tif" and "Can 3x2Sign.tif"? That will help use track down the issue.

p.s. Are you using the latest version of Magick.NET?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
bungle
Posts: 7
Joined: 2015-02-06T16:50:38-07:00
Authentication code: 6789

Re: Composite: Differences in defaults/transparency between v6 and v7?

Post by bungle »

Okay, it definitely seems to have something to do with the TIF format of the overlay image, perhaps the fact that it is CMYK. I broke the test down a bit more and discovered that any manipulation of the price image causes it to lose the anti-aliasing/transparency. In this zip file is the original price image, "CanPrice.tif", and the results of converting the image to PNG with IM6 and IM7.

Code: Select all

im6>convert CanPrice.tif canpricev6.png
im7>magick CanPrice.tif canpricev7.png
The v6 version looks fine, but the v7 version is jagged when zoomed in. ImageMagick does tell me it doesn't like something about the image:

Code: Select all

magick: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag'

Code: Select all

magick CanPrice.tif -colorspace srgb canpricergb.tif
It also loses the transparency when I just try to change the colorspace. The original price TIF is CMYK - perhaps that is significant? I created a simple rgb TIF with some text using Paint.NET. When I converted that image to PNG with IM7 it did not lose the anti-aliasing effect.

I did try using the magick command instead of composite - it had no effect. This zipfile contains the results of another set of tests. I cannot share the original background image, but I was able to replicate the problem using just a plain white background. I made a TIF and PNG verison of the background. I also used the good PNG version of the price I created with IM6, and created all 8 permutations of the two images. It didn't matter whether the background was TIF or PNG, or whether I was outputting to TIF or PNG. All that mattered was which price image I used. If I used the TIF, the output was jagged. If I used the PNG the output looked fine.

Code: Select all

magick white.tif CanPrice.tif -composite outT-T.tif
magick white.tif CanPrice.png -composite outT-P.tif
magick white.png CanPrice.tif -composite outP-T.tif
magick white.png CanPrice.png -composite outP-P.tif
magick white.png CanPrice.png -composite outP-P.png
magick white.png CanPrice.tif -composite outP-T.png
magick white.Tif CanPrice.tif -composite outT-T.png
magick white.Tif CanPrice.png -composite outT-P.png
I am using the latest Magick.NET code "Magick.NET 7.0.0.0009; Jan 26, 2015, Alpha", but all of the images linked above were generated with the ImageMagick commandline tools on a Windows 7 machine.

Code: Select all

Version: ImageMagick 6.9.0-1 Q8 x64 2014-12-22 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates (built-in): bzlib cairo freetype jbig jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib

Version: ImageMagick 7.0.0-0 Q16 x64 2015-01-09 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
Features: DPC Modules HDRI OpenMP
Delegates (built-in): bzlib cairo freetype jbig jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
I downloaded an older version of Magick.NET (Magick.NET-6.8.9.601-Q16-x64-net20) and it works fine, which seems to further confirm it is something in ImageMagick and not the .NET code.

Thanks, and please let me know if you have any issues getting the images or if you need anything else from me.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Composite: Differences in defaults/transparency between v6 and v7?

Post by dlemstra »

This is indeed a bug in IM7. I just submitted a patch to our SVN repository to fix this. This will be resolved in the next release of Magick.NET. If you need a development build that includes this fix then contact me through CodePlex or send me a PM here.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
bungle
Posts: 7
Joined: 2015-02-06T16:50:38-07:00
Authentication code: 6789

Re: Composite: Differences in defaults/transparency between v6 and v7?

Post by bungle »

Excellent! Thanks for looking into it. We are just starting on this project so I have plenty of time to wait for the next release.
Post Reply