convert translates upside down some picture when converting from jpg to tga

Bug #1838860 reported by Thomas Debesse
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
imagemagick (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

When I convert some jpg image to tga format, the tga image is upside down.

The bug only appears with some jpg images, not all. I can convert thousands of jpg images without problems but in some rare images the bug occurs.

You can find three jpg images that are known to fail there:
https://dl.illwieckz.net/b/imagemagick/bugs/convert-jpg-to-tga-upside-down/convert-jpg-to-tga-upside-down-samples.zip
I also attach to this bug report the smallest sample I have.

If I convert from jpg to png, the png is ok
If I convert from jpg to png then from png to tga, the tga is ok
If I convert from jpg to tga, the tga is upside down

You can reproduce by downloading the samples, then run this code in the directory containing the samples:

for i in *.jpg
do
    n="$(basename "${i}" '.jpg')"
    convert "${i}" "${n}.png"
    convert "${i}" "${n}.tga"
done

You can have a look of the result there:
https://dl.illwieckz.net/b/imagemagick/bugs/convert-jpg-to-tga-upside-down/convert-jpg-to-tga-upside-down.png

You can also download this script there:
https://dl.illwieckz.net/b/imagemagick/bugs/convert-jpg-to-tga-upside-down/convert-jpg-to-tga-upside-down.sh

ProblemType: Bug
DistroRelease: Ubuntu 19.04
Package: imagemagick-6.q16 8:6.9.10.14+dfsg-7ubuntu2.2
ProcVersionSignature: Ubuntu 5.0.0-21.22-generic 5.0.15
Uname: Linux 5.0.0-21-generic x86_64
ApportVersion: 2.20.10-0ubuntu27.1
Architecture: amd64
CurrentDesktop: GNOME
Date: Sun Aug 4 01:59:00 2019
SourcePackage: imagemagick
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.default.apport: [modified]
mtime.conffile..etc.default.apport: 2018-06-16T17:39:00.798346

Revision history for this message
Thomas Debesse (illwieckz) wrote :
Revision history for this message
Thomas Debesse (illwieckz) wrote :

Bad news, sometime the converted png from jpg displays properly but is then set upside-down when converting from png to tga.

I updated the screenshot of the bug:
https://dl.illwieckz.net/b/imagemagick/bugs/convert-jpg-to-tga-upside-down/convert-jpg-to-tga-upside-down.png

And the script to reproduce:
https://dl.illwieckz.net/b/imagemagick/bugs/convert-jpg-to-tga-upside-down/convert-jpg-to-tga-upside-down.sh

Which now looks like this:

for i in *.jpg
do
    n="$(basename "${i}" '.jpg')"
    convert "${i}" "${n}.png"
    convert "${i}" "${n}.tga"
    convert "${n}.png" "${n}.png.tga"
done

When I said converting from jpg to png to tga worked, in fact I had only tested with one file. It's not always true. With the provided "noships.jpg" file, the bug is carried over the png.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in imagemagick (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.