Corrupted image after sent through stdout/pipe
Posted: 2017-04-21T08:54:25-07:00
Hi, I have encountered this bug today. When I create image combined of multiple others (i.e., montage, append, etc.) and the first image of those is null: , then the resulting image sent through pipe/stdout is corrupted and fails to identify/display. In my logs I will use stdout redirection, but I first stumbled upon this bug using pipes, so I guess they suffer the exact same problem.
Running OS and IM version:
I apologize if my version of IM is very old, the bug is non-existent in newer versions, and you couldn't care less about it . I am using default package on Debian. In such case, I hope this bug report will give you some valuable information at least.
The image used in my scenario (this current image is quite sparse and small, but any a.png image I tried resulted in the same bug):
Example:
However, there is no problem if the first argument is an existing image:
Also, the first scenario works without problem in case I don't use stdout/pipe and store the result directly in a file:
The behavior is the same when piping the image, or when using similar tools (e.g. montage).
Running OS and IM version:
Code: Select all
dzuremar@trollpad:~/Downloads$ uname -a
Linux trollpad 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1+deb8u2 (2017-03-07) x86_64 GNU/Linux
dzuremar@trollpad:~/Downloads$ convert -version
Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-03-12 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib
The image used in my scenario (this current image is quite sparse and small, but any a.png image I tried resulted in the same bug):
Code: Select all
dzuremar@trollpad:~$ identify a.png
a.png PNG 256x256 256x256+0+0 8-bit RGB 439B 0.000u 0:00.000
Code: Select all
dzuremar@trollpad:~$ convert -geometry 256x256 -append null: a.png - > result.png
dzuremar@trollpad:~$ identify result.png
identify: improper image header `result.png' @ error/png.c/ReadPNGImage/3930.
Code: Select all
dzuremar@trollpad:~$ convert -geometry 256x256 -append a.png null: - > result.png
dzuremar@trollpad:~$ identify result.png
result.png PNG 256x512 256x512+0+0 8-bit RGB 714B 0.000u 0:00.000
Code: Select all
dzuremar@trollpad:~$ convert -geometry 256x256 -append null: a.png result.png
dzuremar@trollpad:~$ identify result.png
result.png PNG 256x512 256x512+0+0 16-bit sRGB 1.2KB 0.000u 0:00.000