Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 95703 - media-libs/jpeg - jpegtran corrupts images when rotating JPEGs
Summary: media-libs/jpeg - jpegtran corrupts images when rotating JPEGs
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo Graphics Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-10 09:57 UTC by Rod Smith
Modified: 2005-09-16 18:09 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Sample graphic that demonstrates the problem after rotation (sample.jpg,105.93 KB, image/jpeg)
2005-06-10 09:58 UTC, Rod Smith
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rod Smith 2005-06-10 09:57:27 UTC
Rotated images are corrupted by having a strip a few pixels wide transferred
from one edge of the graphic to the other edge.

Reproducible: Sometimes
Steps to Reproduce:
1. Use "jpegtran -rotate 90 infile.jpg > outfile.jpg"

Actual Results:  
outfile.jpg is properly rotated, but a strip along one edge is likely to be
misplaced (transferred from the opposite edge). I've used both XV and the GIMP
to view the rotated images, and both show the problem.

Expected Results:  
The image should be rotated without corruption.

I've placed a sample input file at http://www.rodsbooks.com/sample.jpg. This
file definitely shows the problem, as do others I've tested.

Not all rotations produce this problem, but I haven't tracked down the precise
conditions that create it.
Comment 1 Rod Smith 2005-06-10 09:58:41 UTC
Created attachment 61000 [details]
Sample graphic that demonstrates the problem after rotation
Comment 2 SpanKY gentoo-dev 2005-09-06 15:37:53 UTC
try jpeg-6b-r6 please
Comment 3 Mark Loeser (RETIRED) gentoo-dev 2005-09-16 18:09:32 UTC
This is regular behaviour on the part of jpegtran.

From the man page:

jpegtran's  default  behavior  when  transforming  an odd-size image is
designed to preserve exact reversibility and  mathematical  consistency
of  the  transformation  set.  As stated, transpose is able to flip the
entire image area.  Horizontal mirroring leaves any partial iMCU column
at the right edge untouched, but is able to flip all rows of the image.
Similarly, vertical mirroring leaves any partial iMCU row at the bottom
edge  untouched, but is able to flip all columns.  The other transforms
can be built up as sequences of transpose and flip operations; for con-
sistency,  their  actions  on edge pixels are defined to be the same as
the end result of the corresponding transpose-and-flip sequence.

For practical use, you may prefer to discard any  untransformable  edge
pixels  rather  than  having  a  strange-looking  strip along the right
and/or bottom edges of a transformed image.  To do this, add the  -trim
switch:

-trim  Drop non-transformable edge blocks.

So, add -trim if you want to use jpegtran and don't want your images to look
weird :)