이미지 exif 정보 읽어오기

컴터/Flash & Flex 2008.08.20 22:48
http://cafe.naver.com/ArticleRead.nhn?clubid=10833316&page=1&menuid=131&boardtype=L&articleid=11811

포토샵이나 ACDSee 에서 적은 IPTC 규약의 정보를 flex 는 읽어 올수 있나 하는 질문입니다.

php에서는 읽을 수 있는데 flex 나 air 에서 직접읽을수 있으면 더 좋은 상황이라 질문을 적습니다.


이걸 읽어야 사용자의 작업이 편해 지는 상황인지라..^^


api 는 찾아도 없는건지 제가 못 찾은 건지...

혹여 알고 계시는분 힌트 좀 주세요.

답변
검쉰 관련 레퍼런스는 없지만 byte 수준에서 읽어와야될겁니다.

검쉰 http://code.shichiseki.jp/as3/ExifInfo/ 여기 보시면 exif 정보를 읽어오도록 구현해놨습니다.
참고하심 될듯





--------------------------------------------------------------------------------------
http://code.shichiseki.jp/as3/ExifInfo/

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.

License

MIT-license


Trackbacks 1 : Comments 0

Write a comment