1 | /*
|
---|
2 | * Copyright 2002-2019 Drew Noakes and contributors
|
---|
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 |
|
---|
22 | package com.drew.metadata.photoshop;
|
---|
23 |
|
---|
24 | import com.drew.lang.annotations.NotNull;
|
---|
25 | import com.drew.metadata.Directory;
|
---|
26 |
|
---|
27 | import java.util.HashMap;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * Holds the basic metadata found in the header of a Photoshop PSD file.
|
---|
31 | *
|
---|
32 | * @author Drew Noakes https://drewnoakes.com
|
---|
33 | */
|
---|
34 | @SuppressWarnings("WeakerAccess")
|
---|
35 | public class PsdHeaderDirectory extends Directory
|
---|
36 | {
|
---|
37 | /**
|
---|
38 | * The number of channels in the image, including any alpha channels. Supported range is 1 to 56.
|
---|
39 | */
|
---|
40 | public static final int TAG_CHANNEL_COUNT = 1;
|
---|
41 | /**
|
---|
42 | * The height of the image in pixels.
|
---|
43 | */
|
---|
44 | public static final int TAG_IMAGE_HEIGHT = 2;
|
---|
45 | /**
|
---|
46 | * The width of the image in pixels.
|
---|
47 | */
|
---|
48 | public static final int TAG_IMAGE_WIDTH = 3;
|
---|
49 | /**
|
---|
50 | * The number of bits per channel. Supported values are 1, 8, 16 and 32.
|
---|
51 | */
|
---|
52 | public static final int TAG_BITS_PER_CHANNEL = 4;
|
---|
53 | /**
|
---|
54 | * The color mode of the file. Supported values are:
|
---|
55 | * Bitmap = 0; Grayscale = 1; Indexed = 2; RGB = 3; CMYK = 4; Multichannel = 7; Duotone = 8; Lab = 9.
|
---|
56 | */
|
---|
57 | public static final int TAG_COLOR_MODE = 5;
|
---|
58 |
|
---|
59 | @NotNull
|
---|
60 | protected static final HashMap<Integer, String> _tagNameMap = new HashMap<Integer, String>();
|
---|
61 |
|
---|
62 | static {
|
---|
63 | _tagNameMap.put(TAG_CHANNEL_COUNT, "Channel Count");
|
---|
64 | _tagNameMap.put(TAG_IMAGE_HEIGHT, "Image Height");
|
---|
65 | _tagNameMap.put(TAG_IMAGE_WIDTH, "Image Width");
|
---|
66 | _tagNameMap.put(TAG_BITS_PER_CHANNEL, "Bits Per Channel");
|
---|
67 | _tagNameMap.put(TAG_COLOR_MODE, "Color Mode");
|
---|
68 | }
|
---|
69 |
|
---|
70 | public PsdHeaderDirectory()
|
---|
71 | {
|
---|
72 | this.setDescriptor(new PsdHeaderDescriptor(this));
|
---|
73 | }
|
---|
74 |
|
---|
75 | @Override
|
---|
76 | @NotNull
|
---|
77 | public String getName()
|
---|
78 | {
|
---|
79 | return "PSD Header";
|
---|
80 | }
|
---|
81 |
|
---|
82 | @Override
|
---|
83 | @NotNull
|
---|
84 | protected HashMap<Integer, String> getTagNameMap()
|
---|
85 | {
|
---|
86 | return _tagNameMap;
|
---|
87 | }
|
---|
88 | }
|
---|