Changeset 8132 in josm for trunk/src/com/drew/metadata/jpeg/JpegDirectory.java
- Timestamp:
- 2015-03-10T01:17:39+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/drew/metadata/jpeg/JpegDirectory.java
r6127 r8132 1 1 /* 2 * Copyright 2002-201 2Drew Noakes2 * Copyright 2002-2015 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); … … 16 16 * More information about this project is available at: 17 17 * 18 * http://drewnoakes.com/code/exif/ 19 * http ://code.google.com/p/metadata-extractor/18 * https://drewnoakes.com/code/exif/ 19 * https://github.com/drewnoakes/metadata-extractor 20 20 */ 21 21 package com.drew.metadata.jpeg; … … 29 29 30 30 /** 31 * Directory of tags and values for the SOF0 J pegsegment. This segment holds basic metadata about the image.31 * Directory of tags and values for the SOF0 JPEG segment. This segment holds basic metadata about the image. 32 32 * 33 * @author Darrell Silver http://www.darrellsilver.com and Drew Noakes http://drewnoakes.com 33 * @author Darrell Silver http://www.darrellsilver.com and Drew Noakes https://drewnoakes.com 34 34 */ 35 35 public class JpegDirectory extends Directory 36 36 { 37 public static final int TAG_ JPEG_COMPRESSION_TYPE = -3;37 public static final int TAG_COMPRESSION_TYPE = -3; 38 38 /** This is in bits/sample, usually 8 (12 and 16 not supported by most software). */ 39 public static final int TAG_ JPEG_DATA_PRECISION = 0;39 public static final int TAG_DATA_PRECISION = 0; 40 40 /** The image's height. Necessary for decoding the image, so it should always be there. */ 41 public static final int TAG_ JPEG_IMAGE_HEIGHT = 1;41 public static final int TAG_IMAGE_HEIGHT = 1; 42 42 /** The image's width. Necessary for decoding the image, so it should always be there. */ 43 public static final int TAG_ JPEG_IMAGE_WIDTH = 3;43 public static final int TAG_IMAGE_WIDTH = 3; 44 44 /** 45 45 * Usually 1 = grey scaled, 3 = color YcbCr or YIQ, 4 = color CMYK … … 48 48 * sampling factors (1byte) (bit 0-3 vertical., 4-7 horizontal.), 49 49 * quantization table number (1 byte). 50 * <p />50 * <p> 51 51 * This info is from http://www.funducode.com/freec/Fileformats/format3/format3b.htm 52 52 */ 53 public static final int TAG_ JPEG_NUMBER_OF_COMPONENTS = 5;53 public static final int TAG_NUMBER_OF_COMPONENTS = 5; 54 54 55 55 // NOTE! Component tag type int values must increment in steps of 1 56 56 57 /** the first of a possible 4 color components. Number of components specified in TAG_ JPEG_NUMBER_OF_COMPONENTS. */58 public static final int TAG_ JPEG_COMPONENT_DATA_1 = 6;59 /** the second of a possible 4 color components. Number of components specified in TAG_ JPEG_NUMBER_OF_COMPONENTS. */60 public static final int TAG_ JPEG_COMPONENT_DATA_2 = 7;61 /** the third of a possible 4 color components. Number of components specified in TAG_ JPEG_NUMBER_OF_COMPONENTS. */62 public static final int TAG_ JPEG_COMPONENT_DATA_3 = 8;63 /** the fourth of a possible 4 color components. Number of components specified in TAG_ JPEG_NUMBER_OF_COMPONENTS. */64 public static final int TAG_ JPEG_COMPONENT_DATA_4 = 9;57 /** the first of a possible 4 color components. Number of components specified in TAG_NUMBER_OF_COMPONENTS. */ 58 public static final int TAG_COMPONENT_DATA_1 = 6; 59 /** the second of a possible 4 color components. Number of components specified in TAG_NUMBER_OF_COMPONENTS. */ 60 public static final int TAG_COMPONENT_DATA_2 = 7; 61 /** the third of a possible 4 color components. Number of components specified in TAG_NUMBER_OF_COMPONENTS. */ 62 public static final int TAG_COMPONENT_DATA_3 = 8; 63 /** the fourth of a possible 4 color components. Number of components specified in TAG_NUMBER_OF_COMPONENTS. */ 64 public static final int TAG_COMPONENT_DATA_4 = 9; 65 65 66 66 @NotNull … … 68 68 69 69 static { 70 _tagNameMap.put(TAG_ JPEG_COMPRESSION_TYPE, "Compression Type");71 _tagNameMap.put(TAG_ JPEG_DATA_PRECISION, "Data Precision");72 _tagNameMap.put(TAG_ JPEG_IMAGE_WIDTH, "Image Width");73 _tagNameMap.put(TAG_ JPEG_IMAGE_HEIGHT, "Image Height");74 _tagNameMap.put(TAG_ JPEG_NUMBER_OF_COMPONENTS, "Number of Components");75 _tagNameMap.put(TAG_ JPEG_COMPONENT_DATA_1, "Component 1");76 _tagNameMap.put(TAG_ JPEG_COMPONENT_DATA_2, "Component 2");77 _tagNameMap.put(TAG_ JPEG_COMPONENT_DATA_3, "Component 3");78 _tagNameMap.put(TAG_ JPEG_COMPONENT_DATA_4, "Component 4");70 _tagNameMap.put(TAG_COMPRESSION_TYPE, "Compression Type"); 71 _tagNameMap.put(TAG_DATA_PRECISION, "Data Precision"); 72 _tagNameMap.put(TAG_IMAGE_WIDTH, "Image Width"); 73 _tagNameMap.put(TAG_IMAGE_HEIGHT, "Image Height"); 74 _tagNameMap.put(TAG_NUMBER_OF_COMPONENTS, "Number of Components"); 75 _tagNameMap.put(TAG_COMPONENT_DATA_1, "Component 1"); 76 _tagNameMap.put(TAG_COMPONENT_DATA_2, "Component 2"); 77 _tagNameMap.put(TAG_COMPONENT_DATA_3, "Component 3"); 78 _tagNameMap.put(TAG_COMPONENT_DATA_4, "Component 4"); 79 79 } 80 80 … … 84 84 } 85 85 86 @Override 86 87 @NotNull 87 88 public String getName() 88 89 { 89 return "J peg";90 return "JPEG"; 90 91 } 91 92 93 @Override 92 94 @NotNull 93 95 protected HashMap<Integer, String> getTagNameMap() … … 104 106 public JpegComponent getComponent(int componentNumber) 105 107 { 106 int tagType = JpegDirectory.TAG_ JPEG_COMPONENT_DATA_1 + componentNumber;108 int tagType = JpegDirectory.TAG_COMPONENT_DATA_1 + componentNumber; 107 109 return (JpegComponent)getObject(tagType); 108 110 } … … 110 112 public int getImageWidth() throws MetadataException 111 113 { 112 return getInt(JpegDirectory.TAG_ JPEG_IMAGE_WIDTH);114 return getInt(JpegDirectory.TAG_IMAGE_WIDTH); 113 115 } 114 116 115 117 public int getImageHeight() throws MetadataException 116 118 { 117 return getInt(JpegDirectory.TAG_ JPEG_IMAGE_HEIGHT);119 return getInt(JpegDirectory.TAG_IMAGE_HEIGHT); 118 120 } 119 121 120 122 public int getNumberOfComponents() throws MetadataException 121 123 { 122 return getInt(JpegDirectory.TAG_ JPEG_NUMBER_OF_COMPONENTS);124 return getInt(JpegDirectory.TAG_NUMBER_OF_COMPONENTS); 123 125 } 124 126 }
Note:
See TracChangeset
for help on using the changeset viewer.
