Black line appears sometimes on images resized by convert
Posted: 2010-06-23T01:53:08-07:00
I work for deviantArt and we use ImageMagick on a boatload of images, as one might expect from a large traffic website where users can submit an unlimited amount of image files. We have a cluster dedicated to running image conversion jobs. For a while now we've had a bug in ImageMagick haunt us: http://fc01.deviantart.net/fs70/i/2010/ ... urlove.jpg As you can see, that image has a horizontal black line. That line wasn't there on the original JPEG image that was resized to 900x1214 using convert.
The bug isn't reproducible, if we run the same command on the same original image, there's a very high probability that it will succeed and the black line won't be there in the output image anymore. It's somehow linked to server load and could be related to low available memory conditions.
We suspect that it's linked to an internal ImageMagick process that creates two temporary files instead of one while convert runs and will stitch the 2 temporary images into one. We've witnessed that the black line appears where the separation between the two temporary files was. We think that there might be a bug in that stitching step that combines the two temporary files created by IM under specific memory or load conditions. Someone familiar with the ImageMagick source code might know where that stitching process's code is, I'd be happy to take a look myself to try and understand the situation better.
This is what the command we run usually looks like:
convert -limit memory 512 -limit map 1024 -type TrueColor -quality 85 -define jpeg:size=1800x2376 blacklinetest.jpg[900X1188] -strip JPG:test.jpg
We're currently running ImageMagick 6.5.7-4 2009-11-03 Q8. Before someone points out that we should update, we would only do it if someone can show us that this bug is known and has already been addressed in a more recent release. If it's news to the wizards, then there's no point for us to go through the painful and risky process of updating IM on our production image resizing cluster.
The bug isn't reproducible, if we run the same command on the same original image, there's a very high probability that it will succeed and the black line won't be there in the output image anymore. It's somehow linked to server load and could be related to low available memory conditions.
We suspect that it's linked to an internal ImageMagick process that creates two temporary files instead of one while convert runs and will stitch the 2 temporary images into one. We've witnessed that the black line appears where the separation between the two temporary files was. We think that there might be a bug in that stitching step that combines the two temporary files created by IM under specific memory or load conditions. Someone familiar with the ImageMagick source code might know where that stitching process's code is, I'd be happy to take a look myself to try and understand the situation better.
This is what the command we run usually looks like:
convert -limit memory 512 -limit map 1024 -type TrueColor -quality 85 -define jpeg:size=1800x2376 blacklinetest.jpg[900X1188] -strip JPG:test.jpg
We're currently running ImageMagick 6.5.7-4 2009-11-03 Q8. Before someone points out that we should update, we would only do it if someone can show us that this bug is known and has already been addressed in a more recent release. If it's news to the wizards, then there's no point for us to go through the painful and risky process of updating IM on our production image resizing cluster.