Page 1 of 1

RESOLVED:possible bug -compose displace / -extent IM6896

Posted: 2014-08-12T19:04:03-07:00
by fmw42
I have a strange bug that might relate to -compose displace or -extent where the background is not being filled properly unless I add +write PNG:null:


This relates to my trying to compress the code from my cylinderize script into a new script that does not recreate the displacement map each time.

I have simplified the code as far as I can and still reproduce the issue.

input image:
Image

displacement map image:
Image


This code fails to fill the background completely with black and keeps some transparency.

Code: Select all

convert -respect-parenthesis \
\( "img5967.jpg" +repage -gravity center -background none -extent 149x224 \
-resize 93.9691x100% -background black -gravity west -extent 149.591x224 \) \
"displace.png" -virtual-pixel black -background black -gravity northwest \
-define compose:args=9.57656x112 -compose displace -composite test3c.png
Image


This code works fine so long as I add +write PNG:null: (it does not work if I use +write MIFF:null)

Code: Select all

convert -respect-parenthesis \
\( "img5967.jpg" +repage -gravity center -background none -extent 149x224 \
-resize 93.9691x100% -background black -gravity west -extent 149.591x224 +write PNG:null: \) \
"displace.png" -virtual-pixel black -background black -gravity northwest \
-define compose:args=9.57656x112 -compose displace -composite test4c.png

Image


Am I missing some setting that needs to be reinitialized to its default?

Re: possible bug -compose displace / -extent IM 6.8.9.6 Q16

Posted: 2014-08-13T02:58:37-07:00
by snibgo
With IM v6.8.9-5 Q16 integer on Windows 8.1, your first command gives a result close to your desired result. RMSE 0.06, ie 6% difference. Your second command fails with:

Code: Select all

convert.exe: unable to open image `null:': Invalid argument @ error/blob.c/OpenBlob/2658.
convert.exe: WriteBlob Failed `null:' @ error/png.c/MagickPNGErrorHandler/1805.
With IM v6.8.9-6 Q32 HDRI, self-compiled on Cygwin, your first and second commands give identical results, even closer to your desired result (RMSE 0.001).

Re: possible bug -compose displace / -extent IM 6.8.9.6 Q16

Posted: 2014-08-13T06:22:27-07:00
by magick
Alpha channels are undefined by default. Add an opaque alpha channel to your displacement map with -alpha to initialize the alpha channel to a known value. Does that fix the problem?

Re: possible bug -compose displace / -extent IM 6.8.9.6 Q16

Posted: 2014-08-13T09:50:28-07:00
by fmw42
magick wrote:Alpha channels are undefined by default. Add an opaque alpha channel to your displacement map with -alpha to initialize the alpha channel to a known value. Does that fix the problem?
That fixed it. Thanks very much.