/[packages]/cauldron/metadata-extractor/current/SOURCES/metadata-extractor-2.4.0-beta-1-nosun.patch
ViewVC logotype

Contents of /cauldron/metadata-extractor/current/SOURCES/metadata-extractor-2.4.0-beta-1-nosun.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 133617 - (show annotations) (download)
Mon Aug 15 19:15:41 2011 UTC (9 years, 11 months ago) by gil
File size: 3710 byte(s)
imported package metadata-extractor
1 diff -Nru Source/com/drew/imaging/jpeg/JpegMetadataReader.java Source-gil/com/drew/imaging/jpeg/JpegMetadataReader.java
2 --- Source/com/drew/imaging/jpeg/JpegMetadataReader.java 2006-11-30 01:51:20.000000000 +0100
3 +++ Source-gil/com/drew/imaging/jpeg/JpegMetadataReader.java 2011-08-15 21:10:35.000000000 +0200
4 @@ -21,7 +21,6 @@
5 import com.drew.metadata.iptc.IptcReader;
6 import com.drew.metadata.jpeg.JpegCommentReader;
7 import com.drew.metadata.jpeg.JpegReader;
8 -import com.sun.image.codec.jpeg.JPEGDecodeParam;
9
10 import java.io.File;
11 import java.io.InputStream;
12 @@ -82,36 +81,6 @@
13
14 return metadata;
15 }
16 -
17 - public static Metadata readMetadata(JPEGDecodeParam decodeParam)
18 - {
19 - final Metadata metadata = new Metadata();
20 -
21 - /* We should only really be seeing Exif in _data[0]... the 2D array exists
22 - * because markers can theoretically appear multiple times in the file.
23 - */
24 - // TODO test this method
25 - byte[][] exifSegment = decodeParam.getMarkerData(JPEGDecodeParam.APP1_MARKER);
26 - if (exifSegment != null && exifSegment[0].length>0) {
27 - new ExifReader(exifSegment[0]).extract(metadata);
28 - }
29 -
30 - // similarly, use only the first IPTC segment
31 - byte[][] iptcSegment = decodeParam.getMarkerData(JPEGDecodeParam.APPD_MARKER);
32 - if (iptcSegment != null && iptcSegment[0].length>0) {
33 - new IptcReader(iptcSegment[0]).extract(metadata);
34 - }
35 -
36 - // NOTE: Unable to utilise JpegReader for the SOF0 frame here, as the decodeParam doesn't contain the byte[]
37 -
38 - // similarly, use only the first Jpeg Comment segment
39 - byte[][] jpegCommentSegment = decodeParam.getMarkerData(JPEGDecodeParam.COMMENT_MARKER);
40 - if (jpegCommentSegment != null && jpegCommentSegment[0].length>0) {
41 - new JpegCommentReader(jpegCommentSegment[0]).extract(metadata);
42 - }
43 -
44 - return metadata;
45 - }
46
47 private JpegMetadataReader() throws Exception
48 {
49 diff -Nru Source/com/drew/metadata/test/SampleUsage.java Source-gil/com/drew/metadata/test/SampleUsage.java
50 --- Source/com/drew/metadata/test/SampleUsage.java 2006-11-30 02:33:22.000000000 +0100
51 +++ Source-gil/com/drew/metadata/test/SampleUsage.java 2011-08-15 21:13:34.000000000 +0200
52 @@ -26,9 +26,6 @@
53 import com.drew.metadata.Metadata;
54 import com.drew.metadata.Directory;
55 import com.drew.metadata.Tag;
56 -import com.sun.image.codec.jpeg.JPEGCodec;
57 -import com.sun.image.codec.jpeg.JPEGDecodeParam;
58 -import com.sun.image.codec.jpeg.JPEGImageDecoder;
59
60 import java.awt.image.BufferedImage;
61 import java.io.File;
62 @@ -90,21 +87,6 @@
63 System.err.println("error 3a: " + e);
64 }
65
66 - // Approach 4
67 - // This approach is the slowest, because it decodes the Jpeg image. Of course you now have a decoded image to
68 - // play with. In some instances this will be most appropriate.
69 - try {
70 - JPEGImageDecoder jpegDecoder = JPEGCodec.createJPEGDecoder(new FileInputStream(file));
71 - BufferedImage image = jpegDecoder.decodeAsBufferedImage();
72 - // now you can use the image
73 - JPEGDecodeParam decodeParam = jpegDecoder.getJPEGDecodeParam();
74 - Metadata metadata = JpegMetadataReader.readMetadata(decodeParam);
75 - printImageTags(4, metadata);
76 - } catch (FileNotFoundException e) {
77 - System.err.println("error 4a: " + e);
78 - } catch (IOException e) {
79 - System.err.println("error 4b: " + e);
80 - }
81 }
82
83 private void printImageTags(int approachCount, Metadata metadata)

  ViewVC Help
Powered by ViewVC 1.1.28