source: josm/trunk/src/com/drew/metadata/exif/ExifThumbnailDescriptor.java@ 8243

Last change on this file since 8243 was 8243, checked in by Don-vip, 10 years ago

fix #11359 - update to metadata-extractor 2.8.1

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 3.6 KB
Line 
1/*
2 * Copyright 2002-2015 Drew Noakes
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * More information about this project is available at:
17 *
18 * https://drewnoakes.com/code/exif/
19 * https://github.com/drewnoakes/metadata-extractor
20 */
21
22package com.drew.metadata.exif;
23
24import com.drew.lang.annotations.NotNull;
25import com.drew.lang.annotations.Nullable;
26
27import static com.drew.metadata.exif.ExifThumbnailDirectory.*;
28
29/**
30 * Provides human-readable string representations of tag values stored in a {@link ExifThumbnailDirectory}.
31 *
32 * @author Drew Noakes https://drewnoakes.com
33 */
34public class ExifThumbnailDescriptor extends ExifDescriptorBase<ExifThumbnailDirectory>
35{
36 public ExifThumbnailDescriptor(@NotNull ExifThumbnailDirectory directory)
37 {
38 super(directory);
39 }
40
41 @Override
42 @Nullable
43 public String getDescription(int tagType)
44 {
45 switch (tagType) {
46 case TAG_THUMBNAIL_OFFSET:
47 return getThumbnailOffsetDescription();
48 case TAG_THUMBNAIL_LENGTH:
49 return getThumbnailLengthDescription();
50 case TAG_THUMBNAIL_COMPRESSION:
51 return getCompressionDescription();
52 default:
53 return super.getDescription(tagType);
54 }
55 }
56
57 @Nullable
58 public String getCompressionDescription()
59 {
60 Integer value = _directory.getInteger(TAG_THUMBNAIL_COMPRESSION);
61 if (value == null)
62 return null;
63 switch (value) {
64 case 1: return "Uncompressed";
65 case 2: return "CCITT 1D";
66 case 3: return "T4/Group 3 Fax";
67 case 4: return "T6/Group 4 Fax";
68 case 5: return "LZW";
69 case 6: return "JPEG (old-style)";
70 case 7: return "JPEG";
71 case 8: return "Adobe Deflate";
72 case 9: return "JBIG B&W";
73 case 10: return "JBIG Color";
74 case 32766: return "Next";
75 case 32771: return "CCIRLEW";
76 case 32773: return "PackBits";
77 case 32809: return "Thunderscan";
78 case 32895: return "IT8CTPAD";
79 case 32896: return "IT8LW";
80 case 32897: return "IT8MP";
81 case 32898: return "IT8BL";
82 case 32908: return "PixarFilm";
83 case 32909: return "PixarLog";
84 case 32946: return "Deflate";
85 case 32947: return "DCS";
86 case 32661: return "JBIG";
87 case 32676: return "SGILog";
88 case 32677: return "SGILog24";
89 case 32712: return "JPEG 2000";
90 case 32713: return "Nikon NEF Compressed";
91 default:
92 return "Unknown compression";
93 }
94 }
95
96 @Nullable
97 public String getThumbnailLengthDescription()
98 {
99 String value = _directory.getString(TAG_THUMBNAIL_LENGTH);
100 return value == null ? null : value + " bytes";
101 }
102
103 @Nullable
104 public String getThumbnailOffsetDescription()
105 {
106 String value = _directory.getString(TAG_THUMBNAIL_OFFSET);
107 return value == null ? null : value + " bytes";
108 }
109}
Note: See TracBrowser for help on using the repository browser.