The Exif API provides interfaces and methods for manipulating Exif data from a JPEG file. The ExifManager object provides methods to retrieve the ExifInformation object from a JPEG file and save the Exif data from the ExifInformation object in the JPEG file. The ExifInformation object provides functionality to get and set the Exif attributes corresponding to the Exif tag. Changing the value of the attribute in the ExifInformation object stores the Exif data in the ExifInformation object. It does not change data in the JPEG file. For applying the modified Exif data to the JPEG file, the saveExifInfo() method of the ExifManager object should be called with the ExifInformation object that has the modified Exif data.
For more information about how to use Exif API, see Exif Guide.
Since 2.3
Specifies a white balance mode for an image.
enum WhiteBalanceMode { "AUTO", "MANUAL" };
Specifies an exposure balance program for an image.
enum ExposureProgram { "NOT_DEFINED", "MANUAL", "NORMAL", "APERTURE_PRIORITY", "SHUTTER_PRIORITY", "CREATIVE_PROGRAM", "ACTION_PROGRAM", "PORTRAIT_MODE", "LANDSCAPE_MODE" };
Some additional information can be found in the List of digital camera modes article.
The ExifManagerObject interface defines what is instantiated by the Tizen object from the Tizen Platform. The tizen.exif object allows access to the Exif data of a JPEG file.
[NoInterfaceObject] interface ExifManagerObject { readonly attribute ExifManager exif; };
Tizen implements ExifManagerObject;
The ExifManager interface provides methods to retrieve the ExifInformation object and save the Exif data of the ExifInformation object in a JPEG file.
[NoInterfaceObject] interface ExifManager { void getExifInfo(DOMString uri, ExifInformationSuccessCallback successCallback, optional ErrorCallback? errorCallback ) raises(WebAPIException); void saveExifInfo(ExifInformation exifInfo, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void getThumbnail(DOMString uri, ExifThumbnailSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); };
It provides access to the API functionalities through the tizen.exif interface.
getExifInfo
Gets the ExifInformation object to manipulate the Exif data in a JPEG file.
void getExifInfo(DOMString uri, ExifInformationSuccessCallback successCallback, optional ErrorCallback? errorCallback);
This function returns (via callback) the ExifInformation object that contains the Exif data in the JPEG file.
The errorCallback is launched with these error types:
Parameters:
Exceptions:
Code example:
//Preconditions: please provide images/tizen.jpg file with present Exif data // Defines success callback function onSuccess(exifInfo) { console.log("success to get Exif information object"); } // Defines error callback function onError(error) { console.log("error occurred: " + error.name); } function resolveSuccess(file) { tizen.exif.getExifInfo(file.toURI(), onSuccess, onError); } function resolveFail(error) { console.log("error occurred: " + error.name); } tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
saveExifInfo
Saves the Exif data of the ExifInformation object into the JPEG file.
void saveExifInfo(ExifInformation exifInfo, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
//Preconditions: please provide images/tizen.jpg file with present Exif data // Defines success callback function onSaveSuccess() { console.log("success to save Exif information"); } // Defines error callback function onSaveError(error) { console.log("error occur" + error.name); } // Defines success callback function onSuccess(exifInfo) { console.log("success to get Exif information object"); exifInfo.orientation = "ROTATE_90"; tizen.exif.saveExifInfo(exifInfo, onSaveSuccess, onSaveError); } // Defines error callback function onError(error) { console.log("error occur" + error.name); } function resolveSuccess(file) { tizen.exif.getExifInfo(file.toURI(), onSuccess, onError); } function resolveFail(error) { console.log("error occurred: " + error.name); } tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
getThumbnail
Gets the thumbnail of the specified JPEG file. If there is no thumbnail in the JPEG file, null is returned.
void getThumbnail(DOMString uri, ExifThumbnailSuccessCallback successCallback, optional ErrorCallback? errorCallback);
successCallback is invoked with a URI as the first argument. This URI is a data URI. It can be used as an src attribute value of the img element.
//Preconditions: please provide images/tizen.jpg file with present Exif data // Defines success callback function onSuccess(thumbData) { console.log("got thumbnail data of JPEG file"); if (thumbData) { var img = new Image(); img.src = thumbData; document.body.appendChild(img); } } // Defines error callback function onError(error) { console.log("error occur" + error.name); } function resolveSuccess(file) { tizen.exif.getThumbnail(file.toURI(), onSuccess, onError); } function resolveFail(error) { console.log("error occurred: " + error.name); } tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
Dictionary for specifying ExifInformation attributes upon ExifInformation creation.
dictionary ExifInit { DOMString uri; unsigned long width; unsigned long height; DOMString deviceMaker; DOMString deviceModel; Date originalTime; ImageContentOrientation orientation; double fNumber; unsigned short[] isoSpeedRatings; DOMString exposureTime; ExposureProgram exposureProgram; boolean flash; double focalLength; WhiteBalanceMode whiteBalance; SimpleCoordinates gpsLocation; double gpsAltitude; DOMString gpsProcessingMethod; Date gpsTime; DOMString userComment; };
This dictionary is used to input parameters when ExifInformation is created. For description of attributes please see the corresponding attributes in the ExifInformation interface.
The ExifInformation interface implements the ExifInformation object.
[Constructor(optional ExifInit? ExifInitDict)] interface ExifInformation { attribute DOMString uri; attribute unsigned long? width; attribute unsigned long? height; attribute DOMString? deviceMaker; attribute DOMString? deviceModel; attribute Date? originalTime; attribute ImageContentOrientation? orientation; attribute double? fNumber; attribute unsigned short[]? isoSpeedRatings; attribute DOMString? exposureTime; attribute ExposureProgram? exposureProgram; attribute boolean? flash; attribute double? focalLength; attribute WhiteBalanceMode? whiteBalance; attribute SimpleCoordinates? gpsLocation; attribute double? gpsAltitude; attribute DOMString? gpsProcessingMethod; attribute TZDate? gpsTime; attribute DOMString? userComment; };
When the format of a value is given in the attribute description then this format should be followed when updating values.
Every Exif related attribute is nullable - null means that this information is missing in the file. By setting an attribute to null and saving ExifInformation one can remove that Exif tag from the file.
ExifInformation(optional ExifInit? ExifInitDict);
DOMString uri
URI of the image.
The path to the file from which ExifInformation data is collected.
unsigned long width [nullable]
Width of the image i.e. the number of points (pixels) per image line.
Note if the value of this attribute is changed, the new value is not verified against the actual size of the image.
unsigned long height [nullable]
Height of the image i.e. the number of lines in the image.
DOMString deviceMaker [nullable]
Name of the camera manufacturer.
DOMString deviceModel [nullable]
Model name or model number of the camera or input device.
Date originalTime [nullable]
Date and time when the picture was taken.
ImageContentOrientation orientation [nullable]
Orientation of the image when displayed.
This attribute shows the relation between the stored image data and the visual content orientation. In other words - how a stored image should be oriented when presented to the user.
double fNumber [nullable]
The f-number when the image was taken.
Exif specification: "Conversion is not made to the focal length of a 35 mm film".
The f-number is the ratio of the lens' focal length to the diameter of the entrance pupil. F-number is also called focal ratio, f-ratio, f-stop, or relative aperture. Example values: 1.4, 2, 2.8, 4, 5.6, 8, 11 ...
unsigned short[] isoSpeedRatings [nullable]
Photo sensitivity (also called ISO speed and ISO latitude) of the camera or input device.
Example values: 80, 100, 200, 400, 800, 1600, 3200 ..
DOMString exposureTime [nullable]
Exposure time, given in seconds.
If exposure time is below one second it is expressed as 1/x. For example: 1 second exposure is "1", 0.25s is "1/4".
ExposureProgram exposureProgram [nullable]
Exposure balance program used by the camera to set exposure when the picture was taken.
boolean flash [nullable]
Boolean value that indicates whether flash was fired when the picture was taken (true: flash fired).
double focalLength [nullable]
Focal length of the lens, given in mm.
WhiteBalanceMode whiteBalance [nullable]
White balance mode set when the picture was taken.
SimpleCoordinates gpsLocation [nullable]
Latitude and longitude of the camera (from GPS) when the picture was taken.
double gpsAltitude [nullable]
Altitude (from GPS) of the camera when the picture was taken.
This value is expressed in meters above sea level (can be negative).
DOMString gpsProcessingMethod [nullable]
Name of the method used for finding the location.
TZDate gpsTime [nullable]
Date and time information relative to UTC (Universal Time Coordinated) provided by GPS when the photo was taken.
DOMString userComment [nullable]
User comment.
The ExifInformationSuccessCallback interface provides a success callback that is invoked when the Exif information object has been retrieved. This callback interface specifies a success method with an ExifInformation object as an input parameter. It is used in exif.getExifInfo().
[Callback=FunctionOnly, NoInterfaceObject] interface ExifInformationSuccessCallback { void onsuccess(ExifInformation exifInfo); };
onsuccess
Called when the Exif information object has been successfully retrieved.
void onsuccess(ExifInformation exifInfo);
The ExifThumbnailSuccessCallback interface provides a success callback that is invoked when the Exif thumbnail has been retrieved. This callback interface specifies a success method with the URI for the thumbnail as an input parameter. It is used in exif.getThumbnail().
[Callback=FunctionOnly, NoInterfaceObject] interface ExifThumbnailSuccessCallback { void onsuccess(DOMString? uri); };
Called when the thumbnail of the JPEG file has been successfully retrieved.
void onsuccess(DOMString? uri);
module Exif { enum WhiteBalanceMode { "AUTO", "MANUAL" }; enum ExposureProgram { "NOT_DEFINED", "MANUAL", "NORMAL", "APERTURE_PRIORITY", "SHUTTER_PRIORITY", "CREATIVE_PROGRAM", "ACTION_PROGRAM", "PORTRAIT_MODE", "LANDSCAPE_MODE" }; [NoInterfaceObject] interface ExifManagerObject { readonly attribute ExifManager exif; }; Tizen implements ExifManagerObject; [NoInterfaceObject] interface ExifManager { void getExifInfo(DOMString uri, ExifInformationSuccessCallback successCallback, optional ErrorCallback? errorCallback ) raises(WebAPIException); void saveExifInfo(ExifInformation exifInfo, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void getThumbnail(DOMString uri, ExifThumbnailSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); }; dictionary ExifInit { DOMString uri; unsigned long width; unsigned long height; DOMString deviceMaker; DOMString deviceModel; Date originalTime; ImageContentOrientation orientation; double fNumber; unsigned short[] isoSpeedRatings; DOMString exposureTime; ExposureProgram exposureProgram; boolean flash; double focalLength; WhiteBalanceMode whiteBalance; SimpleCoordinates gpsLocation; double gpsAltitude; DOMString gpsProcessingMethod; Date gpsTime; DOMString userComment; }; [Constructor(optional ExifInit? ExifInitDict)] interface ExifInformation { attribute DOMString uri; attribute unsigned long? width; attribute unsigned long? height; attribute DOMString? deviceMaker; attribute DOMString? deviceModel; attribute Date? originalTime; attribute ImageContentOrientation? orientation; attribute double? fNumber; attribute unsigned short[]? isoSpeedRatings; attribute DOMString? exposureTime; attribute ExposureProgram? exposureProgram; attribute boolean? flash; attribute double? focalLength; attribute WhiteBalanceMode? whiteBalance; attribute SimpleCoordinates? gpsLocation; attribute double? gpsAltitude; attribute DOMString? gpsProcessingMethod; attribute TZDate? gpsTime; attribute DOMString? userComment; }; [Callback=FunctionOnly, NoInterfaceObject] interface ExifInformationSuccessCallback { void onsuccess(ExifInformation exifInfo); }; [Callback=FunctionOnly, NoInterfaceObject] interface ExifThumbnailSuccessCallback { void onsuccess(DOMString? uri); }; };