Page 1 of 1

extent turns entire image black

Posted: 2016-10-31T08:26:12-07:00
by sslebedev
Hello,

I have .PNG images and I want to extend their size by several transparent pixels (transparent border, for example). I'm doing it like this:

Code: Select all

magick mogrify -background none -extent 1152x344 Background.png
It works for most of test images given, but several images like this https://www.dropbox.com/s/731r58oh5ncnb ... d.png?dl=0 becomes all black. I can add transparency to the image by '-transparent white' but it is also lost after subsequent extension. I also tryed other options, option orders etc, but it changed nothing.

What am I doing wrong? Why it bahaves like this? Can it be performed without any losses of quality?

Re: extent turns entire image black

Posted: 2016-10-31T10:01:05-07:00
by fmw42
This seems to be an oddity of IM 7. Try adding -alpha set after reading the input.

In IM 6.9.6.2, this works fine

Code: Select all

convert Background.png -background none -extent 1152x344 tmp.png
In IM 7, this produces an all transparent image.

Code: Select all

magick Background.png -background none -extent 1152x344 tmp.png
But this works fine in IM 7

Code: Select all

magick Background.png -alpha set -background none -extent 1152x344 tmp.png
So does this:

Code: Select all

magick mogrify -alpha set -background none -extent 1200x400 background.png

Re: extent turns entire image black

Posted: 2016-10-31T10:19:40-07:00
by sslebedev
Sure, it works, thank you very much.

P.S. I've been sure I tried this combination... (sad)

Re: extent turns entire image black

Posted: 2016-10-31T17:36:08-07:00
by magick
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.