[Webkit-unassigned] [Bug 50847] New: EXIF orientation in JPEG
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Dec 10 14:55:55 PST 2010
https://bugs.webkit.org/show_bug.cgi?id=50847
Summary: EXIF orientation in JPEG
Product: WebKit
Version: 528+ (Nightly build)
Platform: All
OS/Version: All
Status: UNCONFIRMED
Severity: Normal
Priority: P2
Component: Images
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: ctruta at chromium.org
This is a request from a Chromium user. Most digital cameras and even camera phones store JPEG images in a predefined format (typically landscape) and then set the EXIF orientation flag. That flag should not be ignored; otherwise, the image may be displayed sideways or upside-down.
http://code.google.com/p/chromium/issues/detail?id=56845
The orientation flag is found at offset 0x112 within the EXIF marker, and occupies 2 bytes, according to exiftool's documentation:
http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html
A more detailed explanation, showing all the 8 possible orientations, and accompanied by sample code, is available here:
http://sylvana.net/jpegcrop/exif_orientation.html
This can be implemented in WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp as follows:
Read the EXIF marker, extract the two bytes of interest, then populate the pixel data according to the orientation flag. There are 8 possible orientations. Care must be taken when calling setSize: the width and the height stay the same for the orientation values 1,2,3,4, and they are swapped for the values 5,6,7,8.
More EXIF flags can be interpreted later, if the need arises, but for the time being, a check for the EXIF marker, followed by the extraction of endianness and orientation field from the EXIF segment (and perhaps some elementary checks to ensure that it looks like a legitimate EXIF segment) should be sufficient. I see no need for a full-blown parsing of the EXIF stream.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list