Rotate image causes black bars and corruption

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
caliguian
Posts: 33
Joined: 2012-08-10T12:15:13-07:00
Authentication code: 67789

Re: Rotate image causes black bars and corruption

Post by caliguian »

Well, I believe that this is a bug. I got so tired of messing with it that I moved down to ImageMagick 6.9.2-4 and tried it, and BAM it worked correctly again. I'll try to narrow it down to which version in between caused the break, but I believe that it is a bug at least in v6.9.4.3,1.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Rotate image causes black bars and corruption

Post by fmw42 »

try 6.9.4.4 the current version. Perhaps 6.9.4.3 was transitory if they found a bug and immediately changed to 6.9.4.4, since I never got 6.9.4.3.
caliguian
Posts: 33
Joined: 2012-08-10T12:15:13-07:00
Authentication code: 67789

Re: Rotate image causes black bars and corruption

Post by caliguian »

We'll give that a shot next week. Headed to bed for tonight! :) Thank you for the advice!
caliguian
Posts: 33
Joined: 2012-08-10T12:15:13-07:00
Authentication code: 67789

Re: Rotate image causes black bars and corruption

Post by caliguian »

This morning we tested with the following builds:
6.9.3.3 -> good
6.9.3.9 -> still good
6.9.4.1 - still good
6.9.4.2 -> broke. black bars across rotated images.
6.9.4.3 -> still broke
6.9.4.4 -> still broke
6.9.4.5 -> still broke

Please look into this, as it appears to be a bug introduced in v6.9.4.2, and it still exists in the most recent build.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Rotate image causes black bars and corruption

Post by fmw42 »

Perhaps I have missed this, but could you post one of your images that fails and I will test it also.
caliguian
Posts: 33
Joined: 2012-08-10T12:15:13-07:00
Authentication code: 67789

Re: Rotate image causes black bars and corruption

Post by caliguian »

Sure; the image is in the very first post.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Rotate image causes black bars and corruption

Post by fmw42 »

Sorry, my browser did not display the images so I missed them. I have them now.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Rotate image causes black bars and corruption

Post by fmw42 »

Each of these worked fine for me on my Mac OSX Q16 installs (with 2 threads) directly in a terminal window. I did not have a version of IM 6.9.4.3 to test.


im6933 convert image.jpg -auto-orient tmp6933.jpg
im6939 convert image.jpg -auto-orient tmp6939.jpg
im6941 convert image.jpg -auto-orient tmp6941.jpg
im6942 convert image.jpg -auto-orient tmp6942.jpg
im6944 convert image.jpg -auto-orient tmp6944.jpg
convert image.jpg -auto-orient tmp6945.jpg

Each did a proper auto-orient and each had no black areas.

I suspect it is your memory or tmp space that is getting exceeded or perhaps a bad memory chip.

What happens if you install as Q8? That would save memory.

Do you have another computer to test on?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Rotate image causes black bars and corruption

Post by fmw42 »

Are you running this in a terminal or via PHP exec or Imagick. If not the terminal, then perhaps it is your PHP install or Imagick install.

Might you have a bad libjpeg install?
caliguian
Posts: 33
Joined: 2012-08-10T12:15:13-07:00
Authentication code: 67789

Re: Rotate image causes black bars and corruption

Post by caliguian »

fmw42 wrote:Each of these worked fine for me on my Mac OSX Q16 installs directly in a terminal window. I did not have a version of IM 6.9.4.3 to test.

im6933 convert image.jpg -auto-orient tmp6933.jpg
im6939 convert image.jpg -auto-orient tmp6939.jpg
im6941 convert image.jpg -auto-orient tmp6941.jpg
im6942 convert image.jpg -auto-orient tmp6942.jpg
im6944 convert image.jpg -auto-orient tmp6944.jpg
convert image.jpg -auto-orient tmp6945.jpg

Each did a proper auto-orient and each had no black areas.

I suspect it is your memory or tmp space that is getting exceeded or perhaps a bad memory chip.

What happens if you install as Q8? That would save memory.

Do you have another computer to test on?
We have tested this on 7 different servers, each running FreeBSD 10.2, and the same error occurs on each. The problem seems to only occur when it is running in multi-threaded mode. When we switch to "-limit thread 1" on the convert process it works without a problem. We tracked it down to which specific IM version it started failing on, and it started failing on 6.9.4.2.
caliguian
Posts: 33
Joined: 2012-08-10T12:15:13-07:00
Authentication code: 67789

Re: Rotate image causes black bars and corruption

Post by caliguian »

fmw42 wrote:Are you running this in a terminal or via PHP exec or Imagick. If not the terminal, then perhaps it is your PHP install or Imagick install.

Might you have a bad libjpeg install?
This has been tested using PHP exec AND Imagick. Both results are the same across all machines.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Rotate image causes black bars and corruption

Post by fmw42 »

Can you test directly in a terminal window? Otherwise, you will need help from the Imagemagick Developer about OpenMP. I would suggest you contact him (magick) on this forum via the message tool to get his attention about this. Seems to be specific to your OS, since it worked fine for me on my Mac OSX with 2 threads.
caliguian
Posts: 33
Joined: 2012-08-10T12:15:13-07:00
Authentication code: 67789

Re: Rotate image causes black bars and corruption

Post by caliguian »

Alright, I have tested from the command line directly and got the same results. Here is the version information for the one I just tested:
Version: ImageMagick 6.9.4-5 Q16 amd64 2016-05-31 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC OpenMP
Delegates (built-in): bzlib fontconfig jbig jng jp2 jpeg lcms png xml zlib
The command I ran was

Code: Select all

convert 'image.jpg' -auto-orient 'image_rotated.jpg'
This resulted in an image exactly as shown in the first post within this thread (black bars in the same positions even).
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Rotate image causes black bars and corruption

Post by fmw42 »

OK, you will need help from the Imagemagick Developer about OpenMP and your OS regarding this issue. It is clearly a threading issue on your OS. My guess is that the libjpeg delegate is not multi-threaded. Not sure why it worked on your one release.
caliguian
Posts: 33
Joined: 2012-08-10T12:15:13-07:00
Authentication code: 67789

Re: Rotate image causes black bars and corruption

Post by caliguian »

fmw42 wrote:OK, you will need help from the Imagemagick Developer about OpenMP and your OS regarding this issue. It is clearly a threading issue on your OS. My guess is that the libjpeg delegate is not multi-threaded. Not sure why it worked on your one release.
Thank you for trying to help. I have sent a message to magick and we'll see what he thinks.

Thanks!
Post Reply