Page 1 of 1

MergeImageLayers() under linux generates empty image

Posted: 2018-02-05T14:06:00-07:00
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

Re: MergeImageLayers() under linux generates empty image

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

Re: MergeImageLayers() under linux generates empty image

Posted: 2018-02-05T15:12:40-07:00
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.

Re: MergeImageLayers() under linux generates empty image

Posted: 2018-02-05T22:11:23-07:00
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.

Re: MergeImageLayers() under linux generates empty image

Posted: 2018-02-05T22:18:27-07:00
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?

Re: MergeImageLayers() under linux generates empty image

Posted: 2018-02-06T14:44:40-07:00
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().)

Re: MergeImageLayers() under linux generates empty image

Posted: 2018-02-06T14:46:37-07:00
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