Professional Documents
Culture Documents
Orientation in EXIF - Plan
Orientation in EXIF - Plan
Theory: -
EXIF (Exchangeable image file format) is a protocol to store various meta-information about the images
taken by digital cameras. Exif are stored along with the actual image data. Some of the meta info in Exif
includes camera maker, shutter speed, focal length, orientation, shooting time etc. These meta info is
called tags and each tag has a specific tag number decided by the Exif format standard.
All the EXIF images (JPEG, TIFF, PNG, DCX... ) will have a field named Orientation, which determines the
orientation with which an image must be rendered. (There are censors which determine what was the
camera position when the image was captured)
1 EXIF files store the data with some lossy (non-reversible) image data compression
techniques which gives pixels some values with a close approximation. Hence, due to
COMPRESSION, the file size of an EXIF is considerably small but due to LOSSY
COMPRESSION, the pixel colour/intensity is not accurate.
2 When images are photographed, digital cameras use orientation sensors to store an EXIF
orientation value for how the camera is held. While a digital camera may include an option
to "auto-rotate images" due to the camera's orientation, this is just a "virtual rotation". As
lossless image rotation is a compute-intensive operation, digital cameras are not likely to
include true lossless rotation after capturing the photo.
To minimize lossless transformation and reduce the dependency on the camera hardware, we need to
separate out image data with its representation in the image itself.
A flag is set to guide the viewing software which way to rotate the image before display, rather than
rotating the image data itself. (Image editing software should act on the image-file, rather than on the
image-content.)
There are 8 possible values (numbered 1 to 8) for anti-clockwise rotation of an image by 0, 90, 180, 270
and same 4 with mirroring option too.
In OIT, we read the value of Orientation and we drop that information right there. OR We read the value
of Orientation but behave as if it is always 1 (1 is "as is").
So, the problem statement is - OIT should render/export its images as per the Orientation-field
provided in the input image file.
(Customers will not be interested in what is the image type, BPP, dimensions of the image... and would
expect that to be rotated appropriately)
Potential solutions: -
1 In Filter - we can make changes to the EXIF (JPEG/TIFF/PNG) filters, where we consider the
Orientation value in the filter itself and then update the image-data. We will have to
understand different image formats and change the image-data that way!
2 In core - we defer changing the image data till a point which is common between
IX/PX/VW/WV... and there we will change the data. We might have to make some changes
initially as right now; the Orientation value is not brought inside the core. We might have to
create a commonly accessible file which handles orientation and then call this separately
from core section for IX/PX/VW...
Few bugs already raised on this (there are few more which are closed based on ER raised)
Sr No Bug# Title
1 31562116 Embedded JPG image in email file orientation rotated after PDF conversion
2 30380078 feature to have OIT rotate the images in JPG as per the orientation/EXIF data
6 18698381 IMAGE EXPORT FOR A THUMBAIL OF A ROTATED JPG LOOSES THE ROTATION
10 18725769 OUTSIDEIN PDF EXPORT 8.4.1 DOES NOT CHANGE THE ORIENTATION OF THE IMAGE FILE
13 25113336 OPEN IMAGE MENU DROPDOWNS RELOCATE RANDOMLY WHEN ORIENTATION IS CHANGED
Execution plan: -
1 Basic understanding of the image file Understanding image file formats. The 13
formats. These EXIF file formats have a field data stored in it, what signifies the
named Orientation, extracting information orientation, pixel data. Impact of Sub-
from that. JPEG, TIFF… etc files have Sampling, Compression, Encoding. Any
different ways to store Orientation impact of GPS image directions.
information.
2 Implementation of remaining 7 orientation Chunk dump showing Orientation values 8
values across image filters. Right now, in all cases across EXIF file formats.
Orientation is not at all considered… OR it is Finding out the tag in input file under
always treated as 1 (default; Rotated by 0, which the orientation value is given will
no mirroring). be difficult.
3 Implementation of Orientation in core area Image (case 2-4) getting rotated. 12
for first 3 cases (case 2-4), where the image (Rotation by 0-180)
data needs to be rotated/mirrored
appropriately. (average 4 per case, 3*4)
4 Implementation of Orientation in core area Image (case 5-8) getting rotated. 24
for last 4 cases (case 5-8), where the image (Rotation by 90-270)
data needs to be rotated/mirrored
appropriately. (average 6 per case, 4*6)
Implementation Plan: -
1. Person-1, will deep dive into image formats, will try to investigate how to change. Step-1
2. Person-2, in the meantime will bring Orientation value to core. Step-2 (parallel to step-1)