http://drewnoakes.com/code/exif/
위 사이트로 가서 metadata-extractor-2.2.2.jar - compiled classes 를 다운받도록 합니다.
그리고 http://drewnoakes.com/code/exif/sampleUsage.html 에서 sample 코드를 참고하도록 합니다.
import java.io.File;
import java.util.Iterator;
import com.drew.metadata.Tag;
import com.drew.metadata.Directory;
import com.drew.metadata.Metadata;
import com.drew.imaging.jpeg.JpegMetadataReader;
import com.drew.imaging.jpeg.JpegProcessingException;
public class DicaMetaData
{
public static void main(String [] args) throws JpegProcessingException{
File jpegFile = new File("DSCN1036.JPG");
Metadata metadata = JpegMetadataReader.readMetadata(jpegFile);
// iterate through metadata directories
Iterator directories = metadata.getDirectoryIterator();
while (directories.hasNext()) {
Directory directory = (Directory)directories.next();
// iterate through tags and print to System.out
Iterator tags = directory.getTagIterator();
while (tags.hasNext()) {
Tag tag = (Tag)tags.next();
// use Tag.toString()
System.out.println(tag);
}
}
}
}
실행하면
C:\test>java DicaMetaData
dirTagCount = 11
dirTagCount = 35
dirTagCount = 21
dirTagCount = 2
dirTagCount = 6
[Exif] Image Description -
[Exif] Make - NIKON
[Exif] Model - E2500
[Exif] Orientation - top, left side
[Exif] X Resolution - 300 dots per inch
[Exif] Y Resolution - 300 dots per inch
[Exif] Resolution Unit - Inch
[Exif] Software - E2500v1.1
[Exif] Date/Time - 2002:08:08 19:14:55
[Exif] YCbCr Positioning - Center of pixel array
[Exif] Exposure Time - 10/39 sec
[Exif] F-Number - F3.5
[Exif] Exposure Program - Program normal
[Exif] ISO Speed Ratings - 199
[Exif] Exif Version - 2.20
[Exif] Date/Time Original - 2002:08:08 19:14:55
[Exif] Date/Time Digitized - 2002:08:08 19:14:55
[Exif] Components Configuration - YCbCr
[Exif] Compressed Bits Per Pixel - 4 bits/pixel
[Exif] Exposure Bias Value - 0
[Exif] Max Aperture Value - F2.7
[Exif] Metering Mode - Multi-segment
[Exif] Light Source - Unknown
[Exif] Flash - Unknown (16)
[Exif] Focal Length - 9.7 mm
[Exif] User Comment -
[Exif] FlashPix Version - 1.00
[Exif] Color Space - sRGB
[Exif] Exif Image Width - 640 pixels
[Exif] Exif Image Height - 480 pixels
[Exif] File Source - Digital Still Camera (DSC)
[Exif] Scene Type - Directly photographed image
[Exif] Unknown tag (0xa401) - 0
[Exif] Unknown tag (0xa402) - 0
[Exif] Unknown tag (0xa403) - 0
[Exif] Unknown tag (0xa404) - 0
[Exif] Unknown tag (0xa405) - 64
[Exif] Unknown tag (0xa406) - 0
[Exif] Unknown tag (0xa407) - 1
[Exif] Unknown tag (0xa408) - 0
[Exif] Unknown tag (0xa409) - 0
[Exif] Unknown tag (0xa40a) - 0
[Exif] Unknown tag (0xa40c) - 0
[Exif] Compression - JPEG compression
[Exif] Thumbnail Offset - 4084 bytes
[Exif] Thumbnail Length - 5499 bytes
[Exif] Thumbnail Data - [5499 bytes of thumbnail data]
[Nikon Makernote] Firmware Version -
[Nikon Makernote] ISO - 0 0
[Nikon Makernote] Unknown tag (0x0003) - COLOR
[Nikon Makernote] File Format - FINE
[Nikon Makernote] White Balance - AUTO
[Nikon Makernote] Sharpening - AUTO
[Nikon Makernote] AF Type - AF-C
[Nikon Makernote] Unknown 17 -
[Nikon Makernote] Unknown tag (0x000a) - 4416/500
[Nikon Makernote] Unknown tag (0x000f) - AUTO
[Nikon Makernote] Unknown tag (0x0080) - AUTO
[Nikon Makernote] Unknown tag (0x0082) - OFF
[Nikon Makernote] Unknown tag (0x0085) - 0
[Nikon Makernote] Unknown tag (0x0086) - 1
[Nikon Makernote] Unknown 06 -
[Nikon Makernote] Unknown tag (0x008f) - CLOSE UP
[Nikon Makernote] Unknown tag (0x0094) - 0
[Nikon Makernote] Noise Reduction - OFF
[Nikon Makernote] Unknown tag (0x0010) -
[Nikon Makernote] Unknown 03 - 654
[Nikon Makernote] Unknown tag (0x009b) - 0 0
[Interoperability] Interoperability Index - Recommended Exif Interoperability Ru
les (ExifR98)
[Interoperability] Interoperability Version - 1.00
[Jpeg] Data Precision - 8 bits
[Jpeg] Image Height - 480 pixels
[Jpeg] Image Width - 640 pixels
[Jpeg] Number of Components - 3
[Jpeg] Component 1 - Y component: Quantization table 0, Sampling factors 1 horiz
/2 vert
[Jpeg] Component 2 - Cb component: Quantization table 1, Sampling factors 1 hori
z/1 vert
[Jpeg] Component 3 - Cr component: Quantization table 1, Sampling factors 1 hori
z/1 vert
C:\test>
이런 정보가 나옵니다.
-------
자료 및 본문 출처 : okjsp 네버다이님
위 사이트로 가서 metadata-extractor-2.2.2.jar - compiled classes 를 다운받도록 합니다.
그리고 http://drewnoakes.com/code/exif/sampleUsage.html 에서 sample 코드를 참고하도록 합니다.
import java.io.File;
import java.util.Iterator;
import com.drew.metadata.Tag;
import com.drew.metadata.Directory;
import com.drew.metadata.Metadata;
import com.drew.imaging.jpeg.JpegMetadataReader;
import com.drew.imaging.jpeg.JpegProcessingException;
public class DicaMetaData
{
public static void main(String [] args) throws JpegProcessingException{
File jpegFile = new File("DSCN1036.JPG");
Metadata metadata = JpegMetadataReader.readMetadata(jpegFile);
// iterate through metadata directories
Iterator directories = metadata.getDirectoryIterator();
while (directories.hasNext()) {
Directory directory = (Directory)directories.next();
// iterate through tags and print to System.out
Iterator tags = directory.getTagIterator();
while (tags.hasNext()) {
Tag tag = (Tag)tags.next();
// use Tag.toString()
System.out.println(tag);
}
}
}
}
실행하면
C:\test>java DicaMetaData
dirTagCount = 11
dirTagCount = 35
dirTagCount = 21
dirTagCount = 2
dirTagCount = 6
[Exif] Image Description -
[Exif] Make - NIKON
[Exif] Model - E2500
[Exif] Orientation - top, left side
[Exif] X Resolution - 300 dots per inch
[Exif] Y Resolution - 300 dots per inch
[Exif] Resolution Unit - Inch
[Exif] Software - E2500v1.1
[Exif] Date/Time - 2002:08:08 19:14:55
[Exif] YCbCr Positioning - Center of pixel array
[Exif] Exposure Time - 10/39 sec
[Exif] F-Number - F3.5
[Exif] Exposure Program - Program normal
[Exif] ISO Speed Ratings - 199
[Exif] Exif Version - 2.20
[Exif] Date/Time Original - 2002:08:08 19:14:55
[Exif] Date/Time Digitized - 2002:08:08 19:14:55
[Exif] Components Configuration - YCbCr
[Exif] Compressed Bits Per Pixel - 4 bits/pixel
[Exif] Exposure Bias Value - 0
[Exif] Max Aperture Value - F2.7
[Exif] Metering Mode - Multi-segment
[Exif] Light Source - Unknown
[Exif] Flash - Unknown (16)
[Exif] Focal Length - 9.7 mm
[Exif] User Comment -
[Exif] FlashPix Version - 1.00
[Exif] Color Space - sRGB
[Exif] Exif Image Width - 640 pixels
[Exif] Exif Image Height - 480 pixels
[Exif] File Source - Digital Still Camera (DSC)
[Exif] Scene Type - Directly photographed image
[Exif] Unknown tag (0xa401) - 0
[Exif] Unknown tag (0xa402) - 0
[Exif] Unknown tag (0xa403) - 0
[Exif] Unknown tag (0xa404) - 0
[Exif] Unknown tag (0xa405) - 64
[Exif] Unknown tag (0xa406) - 0
[Exif] Unknown tag (0xa407) - 1
[Exif] Unknown tag (0xa408) - 0
[Exif] Unknown tag (0xa409) - 0
[Exif] Unknown tag (0xa40a) - 0
[Exif] Unknown tag (0xa40c) - 0
[Exif] Compression - JPEG compression
[Exif] Thumbnail Offset - 4084 bytes
[Exif] Thumbnail Length - 5499 bytes
[Exif] Thumbnail Data - [5499 bytes of thumbnail data]
[Nikon Makernote] Firmware Version -
[Nikon Makernote] ISO - 0 0
[Nikon Makernote] Unknown tag (0x0003) - COLOR
[Nikon Makernote] File Format - FINE
[Nikon Makernote] White Balance - AUTO
[Nikon Makernote] Sharpening - AUTO
[Nikon Makernote] AF Type - AF-C
[Nikon Makernote] Unknown 17 -
[Nikon Makernote] Unknown tag (0x000a) - 4416/500
[Nikon Makernote] Unknown tag (0x000f) - AUTO
[Nikon Makernote] Unknown tag (0x0080) - AUTO
[Nikon Makernote] Unknown tag (0x0082) - OFF
[Nikon Makernote] Unknown tag (0x0085) - 0
[Nikon Makernote] Unknown tag (0x0086) - 1
[Nikon Makernote] Unknown 06 -
[Nikon Makernote] Unknown tag (0x008f) - CLOSE UP
[Nikon Makernote] Unknown tag (0x0094) - 0
[Nikon Makernote] Noise Reduction - OFF
[Nikon Makernote] Unknown tag (0x0010) -
[Nikon Makernote] Unknown 03 - 654
[Nikon Makernote] Unknown tag (0x009b) - 0 0
[Interoperability] Interoperability Index - Recommended Exif Interoperability Ru
les (ExifR98)
[Interoperability] Interoperability Version - 1.00
[Jpeg] Data Precision - 8 bits
[Jpeg] Image Height - 480 pixels
[Jpeg] Image Width - 640 pixels
[Jpeg] Number of Components - 3
[Jpeg] Component 1 - Y component: Quantization table 0, Sampling factors 1 horiz
/2 vert
[Jpeg] Component 2 - Cb component: Quantization table 1, Sampling factors 1 hori
z/1 vert
[Jpeg] Component 3 - Cr component: Quantization table 1, Sampling factors 1 hori
z/1 vert
C:\test>
이런 정보가 나옵니다.
-------
자료 및 본문 출처 : okjsp 네버다이님
'JAVA' 카테고리의 다른 글
웹페이시 캐쉬 비활성화 (0) | 2007.11.27 |
---|---|
조이스틱 사용 소스 (0) | 2007.08.01 |
Simple Test Code (0) | 2007.07.17 |
JME(jmonkeyengine) (0) | 2007.07.16 |
LWJGL (0) | 2007.07.16 |