Exif library for AS3
This library can read and parse Exif information about a JPEG file. The Exif contains various information about the JPEG file such as the thumbnail image of the JPEG file, image resolution and so on.
See http://www.exif.org/Exif2-2.PDF for details of Exif specification.
Demo
You can see a demo SWF in here (source code of this demo).
Download
You can download this library from CodeRepos by using Subversion. This is the only way to obtain this library for now.
To download Exif library for AS3, use following command:
% svn co http://svn.coderepos.org/share/lang/actionscript/ExifInfo .
Examples
Display thumbnail image
The following code displays original JPEG image and thumbnail image.
import jp.shichiseki.exif.*;var loader:ExifLoader = new ExifLoader();
private function loadImage():void {
loader.addEventListener(Event.COMPLETE, onComplete);
loader.load(new URLRequest(“http://www.example.com/sample.jpg”));
}private function onComplete(e:Event):void {
// display image
addChild(loader);
// display thumbnail image
var thumbLoader:Loader = new Loader();
thumbLoader.loadBytes(loader.exif.thumbnailData);
addChild(thumbLoader);
}
Show Exif IFD informations
The following code shows Exif IFD information.
import jp.shichiseki.exif.*;var loader:ExifLoader = new ExifLoader();
private function loadImage():void {
loader.addEventListener(Event.COMPLETE, onComplete);
loader.load(new URLRequest(“http://www.example.com/sample.jpg”));
}private function onComplete(e:Event):void {
if (loader.exif.ifds.primary)
displayIFD(loader.exif.ifds.primary);
if (loader.exif.ifds.exif)
displayIFD(loader.exif.ifds.exif);
if (loader.exif.ifds.gps)
displayIFD(loader.exif.ifds.gps);
if (loader.exif.ifds.interoperability)
displayIFD(loader.exif.ifds.interoperability);
if (loader.exif.ifds.thumbnail)
displayIFD(loader.exif.ifds.thumbnail);
}private function displayIFD(ifd:IFD):void {
trace(” — ” + ifd.level + ” — “);
for (var entry:String in ifd) {
trace(entry + “: ” + ifd[entry]);
}
}
Documentation
An ASDoc-style API documentation is available here.
Following XML-formatted documents describe the tags which are contained in Exif IFDs.
- 0th IFD TIFF Tags
- 0th IFD Exif Private Tags
- 0th IFD GPS Info Tags
- 0th IFD Interoperability Tags
- 1st IFD TIFF Tags
License
MIT-license