Page 1 of 1

convert -extent not working [Solved]

Posted: 2017-11-07T13:32:09-07:00
by Flesh
I have jpg images that are 4096x4096,
I want to extend the canvas 300 px on both sizes centering the image on the new canvas with transparent background for the new canvas only
So I do not want to change the original image, just pad it on both sides, and convert from jpg to png for transparency background.

This command will work without extending it:
convert in.jpg -alpha set -gravity center -extent 4096x4096 out.png

This one aborts with core dump
convert in.jpg -alpha set -gravity center -extent 4696x4096 out.png

I have tried -format png -resize 4096x4096
and Updated: -background none

mogrify also fails.

This will run as a bash command on over 100,000 files, so speed and quality is best

Running on Linux Manjaro (Arch Linux Clone)
convert -version
Version: ImageMagick 6.9.9-21 Q16 x86_64 2017-10-31 http://www.imagemagick.org
Features: Cipher DPC HDRI Modules OpenCL OpenMP
Delegates (built-in): bzlib cairo fontconfig freetype gslib jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raw rsvg tiff webp wmf x xml zlib

Update: Upgrading to 7 fixed the issue.

Thanks

Re: convert -extent not working

Posted: 2017-11-07T14:22:09-07:00
by Bonzo
Try:

Code: Select all

convert in.jpg -background none -gravity center -extent 4696x4096 out.png

Re: convert -extent not working

Posted: 2017-11-07T14:38:14-07:00
by Flesh
Thanks, but it did not help.

Re: convert -extent not working

Posted: 2017-11-07T15:03:54-07:00
by Bonzo
I recommend you try my code on a different computer/server and see if it works.
Thanks, but it did not help.
What did or did not happen?

Re: convert -extent not working

Posted: 2017-11-07T15:56:34-07:00
by Flesh
That was it, just this machine, the other is setup the same, tired to reinstall imagemagick, no help; so this sucks.
It might be related to this:
https://www.imagemagick.org/discourse-s ... hp?t=24603
I am using opencl-nvidia for cuda in blender; just a guess, but I have it on the other machine also; the only difference I see in machines is AMD vs Intel, and its the Intel machine that is breaking, an i7.

I did need -background none, or its white by default.

Thanks, I should have tried this first, so many times this has bitten me.

Re: convert -extent not working [Solved]

Posted: 2017-11-07T16:26:40-07:00
by Flesh
Upgrading to 7 fixed it.