Solved: Merging 200+ transparent 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?".
Post Reply
tEAm5PYX
Posts: 4
Joined: 2015-07-31T06:37:26-07:00
Authentication code: 1151

Solved: Merging 200+ transparent images

Post by tEAm5PYX »

I have images of all countries in the world. They have exactly the same size and are transparent except for the area with the country. I colorize the countries and then merge the images together to get one image that retains the transparency.

The command I use for merging:

Code: Select all

convert -layers merge -background none countries/* output.png
This works well, but sometimes the output file has a black line somewhere in the image, as shown here:

Image

I guess this is a bug, but I haven't found a way to reproduce it.

Is there any way to work around this by using another command to merge the images?
Last edited by tEAm5PYX on 2015-08-26T06:17:07-07:00, edited 1 time in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Merging 200+ transparent images

Post by magick »

We assume you're running under Linux. Do you have the latest release of ImageMagick, 6.9.1-10? Does it still reproduce the problem? If so, it may be a problem with libgomp, the OpenMP implementation. Try building ImageMagick without OpenMP support:
  • cd ImageMagick-6.9.1-10
    ./configure --disable-openmp
    make install
Rerun your merge. Does the line appear anymore? If so, it could be that some of your images are not fully transparent. If you blend two images that are not fully transparent, a line could appear.
tEAm5PYX
Posts: 4
Joined: 2015-07-31T06:37:26-07:00
Authentication code: 1151

Re: Merging 200+ transparent images

Post by tEAm5PYX »

Thanks for the quick answer! Yes, I'm running Ubuntu Server 14.04 and ImageMagick version 6.9.1-6. I tried the merge command several times with the same images and the black line was only in some of the output files, so I can rule out the images as error source.

I'll try installing the latest version with the configuration you suggested.
tEAm5PYX
Posts: 4
Joined: 2015-07-31T06:37:26-07:00
Authentication code: 1151

Re: Merging 200+ transparent images

Post by tEAm5PYX »

I installed the latest version without OpenMP

Code: Select all

Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-07-31 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC 
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr lzma openexr pangocairo png tiff wmf x xml zlib
but it still happens:

Image

About 5-10% of the merged images end up like this. The Y position varies, but the line always starts at exactly the same X position.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Merging 200+ transparent images

Post by magick »

Before we could comment further, we would need to reproduce the problem so we can trace it. Post a URL to your images and the command set needed to reproduce the problem. Its likely a data driven problem rather than a bug but unless we can reproduce the problem, we can't say for sure.
tEAm5PYX
Posts: 4
Joined: 2015-07-31T06:37:26-07:00
Authentication code: 1151

Re: Merging 200+ transparent images

Post by tEAm5PYX »

I was also using memory and map limits and set them lower than the defaults. It seems that was the cause of this. I removed the limits and haven't seen this problem again.
Post Reply