We're using the version of ImageMagick in CentOS 7, 6.7.8-9, and we're randomly getting a 1-pixel horizontal band (e.g., all black or all white pixels) somewhere in the middle of JPEGs that are being scaled down. Here's a sample command line:
convert -limit map 512mb -limit memory 512mb -limit thread 1 -flatten -scale '1000x1000>' -scale '1000x1000<' -quality 85 -define registry:temporary-path=/opt/lightbox/magick '/opt/lightbox/appfiles/thumbs/thm254sXw/fullIsPm3V.jpg' '/opt/lightbox/appfiles/thumbs/thm254sXw/fullzzVknh.jpg' 2>&1
or
convert -limit map 512mb -limit memory 512mb -limit thread 1 -size 1000x1000 -quality 85 -flatten -scale 1000x1000 '/opt/lightbox/appfiles/thumbs/thm254sXw/fullzzVknh.jpg[1000x1000]' '/opt/lightbox/appfiles/thumbs/thm254sXw/thmFgRpHD.jpg' 2>&1
("flatten" is present because we use the same command with other image types like TIFF and PSD)
This problem is occurring on about 1 out of every 50 images we process this way. We've used many different versions of IM with this app since 2005, and this is the first time I've seen this problem. I searched the release notes for various terms to see if there have been any bugs fixed with this symptom, but I couldn't find anything. We can certainly upgrade to a newer version of IM, but I'd like to know if this is/was a known issue at some point and has been addressed, or whether I'm misusing it, or what.
Occasional 1-pixel horizontal band in output
Re: Occasional 1-pixel horizontal band in output
By "randomly" do you mean "not repeatable", or do you mean that it only happens for particular images? What are the dimensions of an image that fails?
What version of the jpeg library are you using? Type "convert -list format | grep JPEG" to find out.
What version of the jpeg library are you using? Type "convert -list format | grep JPEG" to find out.
Re: Occasional 1-pixel horizontal band in output
We've seen this problem on older versions of ImageMagick. We suspect that if you download the latest ImageMagick release, the problem will "magically" go away.
Re: Occasional 1-pixel horizontal band in output
Thanks, magick, we'll try a newer version.
Re: Occasional 1-pixel horizontal band in output
Unfortunately, the same problem occurs with 6.9.1-2. It's still very sporadic, happening on maybe 1 out of 100 images. The testing we're doing right now is using 100-500 copies of the same image, actually, and it occurs on a different copy in the series each time. We scale the original to a few different sizes, and it even occurs on different sizes. To reiterate, here's a sample command that causes this randomly. The input file was a 3000x3000 square JPEG.
convert -limit map 512mb -limit memory 512mb -limit thread 1 -size 800x800 -quality 85 -flatten -scale 800x800 '/opt/lightbox/appfiles/thumbs/thmoFNf8L/thmFtklCH.jpg[800x800]' '/opt/lightbox/appfiles/thumbs/thmoFNf8L/thmFRavWz.jpg' 2>&1
We built IM with libjpeg-turbo 1.2.90.
convert -limit map 512mb -limit memory 512mb -limit thread 1 -size 800x800 -quality 85 -flatten -scale 800x800 '/opt/lightbox/appfiles/thumbs/thmoFNf8L/thmFtklCH.jpg[800x800]' '/opt/lightbox/appfiles/thumbs/thmoFNf8L/thmFRavWz.jpg' 2>&1
We built IM with libjpeg-turbo 1.2.90.
Re: Occasional 1-pixel horizontal band in output
Any other ideas?
Re: Occasional 1-pixel horizontal band in output
We ran the following script:
10,000 times. The metric always returns 0 which means each thumbnail is exactly the same as the reference (no 1-pixel horizontal band). We're using libjpeg turbo version 1.3.1-5.
To ensure its not a threading issue, build ImageMagick from source with these commands:
Code: Select all
#!/bin/csh
yum list | grep -i turbojpeg
convert -size 3000x3000 plasma:fractal image.jpg
convert -limit map 512mb -limit memory 512mb -limit thread 1 -size 800x800 -quality 85 -flatten -scale 800x800 'image.jpg[800x800]' reference.jpg
set i = 0
while ( $i < 10000 )
echo -n "$i"": "
convert -limit map 512mb -limit memory 512mb -limit thread 1 -size 800x800 -quality 85 -flatten -scale 800x800 'image.jpg[800x800]' thumbnail.jpg
compare -metric rmse thumbnail.jpg reference.jpg null:
echo
@ i ++
end
To ensure its not a threading issue, build ImageMagick from source with these commands:
- ./configure --disable-openmp
make
make install