Page 3 of 3

Re: Rotate image causes black bars and corruption

Posted: 2016-05-31T14:23:21-07:00
by fmw42
I suspect that something has changed in Imagemagick whereby it no longer properly switches over to single threaded libjpeg in a multi-threaded environment. You probably were never getting multi-threaded conversion to jpg.

I also sent him a note to review this post when he gets time.

Re: Rotate image causes black bars and corruption

Posted: 2016-05-31T16:38:16-07:00
by magick
Post the output of `convert -list format` just for JPEG. It tells us which JPEG library you are using. Are you using libjpeg Turbo?

Edit coders/jpeg.c and force NoThreadSupport in RegisterJPEGImage(), there are about 4 places that its conditionally compiled. That should likely fix the problem. If so, let us know and we will adjust the conditional compile of thread support.

Re: Rotate image causes black bars and corruption

Posted: 2016-05-31T17:12:13-07:00
by fmw42
Magick, for my own understanding, is libjpeg multi-threaded or not. He wants to be able to use all 24 processors. He tested -limit thread 1 and it worked fine. But with more than one thread it failed. He said multi-threading worked fine up til 6.9.4.2.

Re: Rotate image causes black bars and corruption

Posted: 2016-05-31T18:37:54-07:00
by caliguian
magick wrote:Post the output of `convert -list format` just for JPEG. It tells us which JPEG library you are using. Are you using libjpeg Turbo?
Here is the JPEG info shown from `convert -list format`
JPE* rw- Joint Photographic Experts Group JFIF format (80)
JPEG* rw- Joint Photographic Experts Group JFIF format (80)
JPG* rw- Joint Photographic Experts Group JFIF format (80)

Re: Rotate image causes black bars and corruption

Posted: 2016-05-31T19:14:36-07:00
by fmw42
There is a more current version of libjpeg. I am on 90.

Re: Rotate image causes black bars and corruption

Posted: 2016-05-31T19:26:52-07:00
by caliguian
magick wrote:Edit coders/jpeg.c and force NoThreadSupport in RegisterJPEGImage(), there are about 4 places that its conditionally compiled. That should likely fix the problem. If so, let us know and we will adjust the conditional compile of thread support.
It seems like this doesn't fix the issue, but instead simply gets rid of thread support. Is that really the solution here?

Re: Rotate image causes black bars and corruption

Posted: 2016-05-31T19:50:45-07:00
by caliguian
fmw42 wrote:There is a more current version of libjpeg. I am on 90.
It looks like we're actually using jpeg-turbo, and it’s on 1.4.2.

Re: Rotate image causes black bars and corruption

Posted: 2016-06-01T05:21:34-07:00
by magick
Let's see if we can identify which auto-orient algorithm is failing. Try each of these commands and let us know which one returns black bars:
  • convert image.jpg -resize 100% clone.jpg
    convert image.jpg -flop flop.jpg
    convert image.jpg -rotate 180 rot180.jpg
    convert image.jpg -flip flip.jpg
    convert image.jpg -transpose transpose.jpg
    convert image.jpg -rotate 90 rot90.jpg
    convert image.jpg -transverse transverse.jpg
    convert image.jpg -rotate 270 rot270.jpg
We tried them on our 20 core CentOS 7 system, and they returned expected results. If you identify the command that fails, try the same command on a PNG image. Do you get the same results? Try the input image as PNG, then the output, then both.

Also, post the output of this command:
  • convert -list configure

Re: Rotate image causes black bars and corruption

Posted: 2016-06-07T08:55:51-07:00
by magick
Download and install ImageMagick 6.9.4-8 or 7.0.1-10. Do you still get black bars?