>> Edit article
이름
제목
패스워드
개인적으로 exif를 acdsee에서 보는데 불편해서 java로 웹상에다가 이미지를 올려주는 프로그램을 하나 만들어 볼까 고민중이었습니다. 그러다가 이곳에서 exif를 다루는 팁이 올라와있네요. 떡본김에 제사지낸다고 java를 이용하여 exif를 볼 수 있는 것이 무엇이 있을까 찾아보니 java media framework 부분에서 그러한 정보를 찾을 수 있더군요. 그런데 jmf 는 너무 덩치가 큰거 같아서 다른쪽을 찾아보다가 api를 발견하였습니다. 사이트는 http://www.drewnoakes.com/code/exif/ 에서 발견하였습니다. jpeg 파일의 exif를 읽어들입니다. source에 대한 간단할 설명도 나오는데요. api를 classpath에 추가한 후 아래와 같은 코드를 돌려보세요. sample을 실행 할 수 있도록 바꿔 보았습니다. <pre> import java.io.*; import java.util.*; import com.drew.imaging.exif.*; import com.drew.imaging.jpeg.*; public class ImageTest{ public static void main(String args[]){ if(args.length != 1){ System.out.println("사용법 java ImageTest jpeg_file_name"); System.exit(0); } File jpegFile = new File(args[0]); ImageInfo info = null; try{ info = new ExifExtractor(jpegFile).extract(); }catch(Exception ex){ System.out.println(ex); System.exit(0); } /* File jpegFile = new File(args[0]); JpegSegmentReader reader = new JpegSegmentReader(jpegFile); byte[] exifSegment = reader.readSegment(JpegSegmentReader.SEGMENT_APP1); ImageInfo info = new ExifExtractor(exifSegment).extract(); */ /* File jpegFile = new File(args[0]); JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(new FileInputStream(blockquote)); BufferedImage img = decoder.decodeAsBufferedImage(); JPEGDecodeParam param = decoder.getJPEGDecodeParam(); ImageInfo info = new ExifExtractor(param).extract(); */ // iterate over the exif data and print to System.out Iterator i = info.getTagIterator(); while (i.hasNext()) { TagValue tag = (TagValue)i.next(); // use TagValue toString() System.out.println(tag); } /* String tag.getDirectoryName() int tag.getDirectoryType() int tag.getTagType() String tag.getTagTypeHex() String tag.getTagName() String tag.getDescription() // the tag's value tag.getDescription() returns a string. You can get the tag's value in it's original type using the ImageInfo instance: int info.getInt(tag); double info.getDouble(tag); float info.getFloat(tag); long info.getLong(tag); Rational info.getRational(tag); java.util.Date info.getDate(tag); Alternatively, you can search for a specific image tag: String cameraMake = info.getString(ImageInfo.IFD_EXIF, ImageInfo.TAG_MAKE); String cameraModel = info.getString(ImageInfo.IFD_EXIF, ImageInfo.TAG_MODEL); */ } // end main } // end class </pre> 흠.. jpeg 이미지 파일을 원하는 크기로 수정하도록 하는 부분을 찾고 있습니다. GUI관련 api를 이용하지 않고 java에서 이미지를 읽어들여 실시간적으로 크기를 변환 시킬 수 있는 것은 어디에 있는지 찾기가 힘드네요 ^^ 조만간에 웹상에다가 이미지를 올리고 Exif정보도 함께 보여주는 jsp파일을 한번 만들어 볼까 생각중입니다. 개인적인 목적의 앨범 사이트를 만들어서 이용하도록 할려고요. 모, 다른 사람도 이용할 수 있도록 만든다면 쓸만 할 것 같습니다. :-) 역시 프로그래밍이라는 것은 필요한 사람이 만들어야 할 것 같아요. 헤헤. : 음 제목이 이상한거 같은데 -_-;; : : 현재 대부분의 디지탈 카메라에서 찍는 이미지에는 : : 헤더부분에 Exif 라는 포맷의 데이터가 들어있습니다. : : 대부분이 카메라와 관련된 내용인데 조사하고 : : 까먹기 싫어서 올립니다 -_-;; : : : Exif File Format : http://www.ba.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html : : php 새로 컴파일 하기 귀찬아서 구현할려다가.. 그게 더 귀찬더라는-_- : : php에선 gd와 --enable-exif 옵션이 붙어야 합니다. : : php에서의 펑션과 예제코드 : : 데이터 글어오기 펑션 : http://php.holywar.net/manual/en/function.exif-read-data.php : 이미지 타입 글거오기 펑션 (-_-;) : http://php.holywar.net/manual/en/function.exif-imagetype.php : 내장된 thumbnail 글거오기 펑션 : http://php.holywar.net/manual/en/function.exif-thumbnail.php : : 예제를 디지탈 카메라로 찍은 이미지에다가 적용해봄 : : http://ns1.sayhome.com/~dj/ -- 아내와 나 사랑이야기를 쓴다.
Copyleft
1999-2026 by
JSBoard Open Project
Theme Designed by
IDOO
All right reserved