MergeImageLayers() under linux generates empty image

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
NoRulez
Posts: 11
Joined: 2017-04-01T00:29:01-07:00
Authentication code: 1151

MergeImageLayers() under linux generates empty image

Post by NoRulez »

Hello,

i use the function MergeImageLayers() to merge the image layers.
Under Windows the following example works fine, but on linux I only get an image with a white background where the file size is about the half of the file size which is created under windows.

Code: Select all

Image *loadedImage = ReadImages(imageInfo, inFilename, exception);
SetImageOption(imageInfo, "background", "White");

Image *newMergedImage = MergeImageLayers(loadedImage, CompositeLayer, exception);
DestroyImage(loadedImage);
loadedImage= newMergedImage;

WriteImages(imageInfo, loadedImage, outFilename, exception);
Could someone please help

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

Re: MergeImageLayers() under linux generates empty image

Post by fmw42 »

Please always provide your IM version for the system(s) in involved when asking questions on this forum.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: MergeImageLayers() under linux generates empty image

Post by snibgo »

See the documentation at http://www.imagemagick.org/script/comma ... php#layers and layer.c MergeImageLayers(). Your chosen method is CompositeLayer but you don't have a "NULL:" image in your list, nor is that method listed as supported by that function.
snibgo's IM pages: im.snibgo.com
NoRulez
Posts: 11
Joined: 2017-04-01T00:29:01-07:00
Authentication code: 1151

Re: MergeImageLayers() under linux generates empty image

Post by NoRulez »

fmw42 wrote: 2018-02-05T14:22:11-07:00 Please always provide your IM version for the system(s) in involved when asking questions on this forum.
Sorry,

on Windows I use ImageMagick-7.0.7-22-Q16-x64-dll.exe and on Linux I use also 7.0.5-4 Q16 x86_64.
NoRulez
Posts: 11
Joined: 2017-04-01T00:29:01-07:00
Authentication code: 1151

Re: MergeImageLayers() under linux generates empty image

Post by NoRulez »

snibgo wrote: 2018-02-05T15:12:40-07:00 See the documentation at http://www.imagemagick.org/script/comma ... php#layers and layer.c MergeImageLayers(). Your chosen method is CompositeLayer but you don't have a "NULL:" image in your list, nor is that method listed as supported by that function.
You're right, I doesn't looked into the implementation details.
I only saw the declaration (LayerMethod) in https://github.com/ImageMagick/ImageMag ... re/layer.h
So, if a LayerMethod isn't supported, then the "default" statement will be used. (See https://github.com/ImageMagick/ImageMag ... er.c#L1940)

Nevertheless, the result is not the same. If my usage is wrong, shouldn't the result be the same on both systems?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: MergeImageLayers() under linux generates empty image

Post by snibgo »

The equivalent usage error at the CLI is caught, eg:

Code: Select all

f:\web\im>%IM%convert rose: -layers Composite out.png

convert.exe: missing Null Image List Separator layers Composite @ error/mogrify.c/MogrifyImageList/8431.
It might be better if MergeImageLayers() returned an error instead of taking a default action.

Different versions of IM may not give the same result even when given the same, sensible function calls. When called in unsupported ways, different versions are even more likely to give different results.

If you want to know why the results are different, you could read IM's source code for those versions. (The critical difference may not be in MergeImageLayers().)
snibgo's IM pages: im.snibgo.com
NoRulez
Posts: 11
Joined: 2017-04-01T00:29:01-07:00
Authentication code: 1151

Re: MergeImageLayers() under linux generates empty image

Post by NoRulez »

I updated the linux version of ImageMagick to match the version on windows (7.0.7-22 Q16), but the behavior does not change
Post Reply