| 1 | package com.drew.metadata.photoshop;
|
|---|
| 2 |
|
|---|
| 3 | import java.io.IOException;
|
|---|
| 4 | import java.util.Set;
|
|---|
| 5 |
|
|---|
| 6 | import com.drew.lang.ByteArrayReader;
|
|---|
| 7 | import com.drew.lang.RandomAccessReader;
|
|---|
| 8 | import com.drew.lang.SequentialByteArrayReader;
|
|---|
| 9 | import com.drew.lang.annotations.NotNull;
|
|---|
| 10 | import com.drew.metadata.Directory;
|
|---|
| 11 | import com.drew.metadata.Metadata;
|
|---|
| 12 | import com.drew.metadata.exif.ExifTiffHandler;
|
|---|
| 13 | import com.drew.metadata.icc.IccReader;
|
|---|
| 14 | //import com.drew.metadata.xmp.XmpReader;
|
|---|
| 15 |
|
|---|
| 16 | /**
|
|---|
| 17 | * @author Payton Garland
|
|---|
| 18 | */
|
|---|
| 19 | public class PhotoshopTiffHandler extends ExifTiffHandler
|
|---|
| 20 | {
|
|---|
| 21 | // Photoshop-specific Tiff Tags
|
|---|
| 22 | // http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577413_pgfId-1039502
|
|---|
| 23 | private static final int TAG_PAGE_MAKER_EXTENSION = 0x014A;
|
|---|
| 24 | private static final int TAG_JPEG_TABLES = 0X01B5;
|
|---|
| 25 | private static final int TAG_XMP = 0x02BC;
|
|---|
| 26 | private static final int TAG_FILE_INFORMATION = 0x83BB;
|
|---|
| 27 | private static final int TAG_PHOTOSHOP_IMAGE_RESOURCES = 0x8649;
|
|---|
| 28 | private static final int TAG_EXIF_IFD_POINTER = 0x8769;
|
|---|
| 29 | private static final int TAG_ICC_PROFILES = 0x8773;
|
|---|
| 30 | private static final int TAG_EXIF_GPS = 0x8825;
|
|---|
| 31 | private static final int TAG_T_IMAGE_SOURCE_DATA = 0x935C;
|
|---|
| 32 | private static final int TAG_T_ANNOTATIONS = 0xC44F;
|
|---|
| 33 |
|
|---|
| 34 | public PhotoshopTiffHandler(Metadata metadata, Directory parentDirectory)
|
|---|
| 35 | {
|
|---|
| 36 | super(metadata, parentDirectory);
|
|---|
| 37 | }
|
|---|
| 38 |
|
|---|
| 39 | @Override
|
|---|
| 40 | public boolean customProcessTag(final int tagOffset,
|
|---|
| 41 | final @NotNull Set<Integer> processedIfdOffsets,
|
|---|
| 42 | final int tiffHeaderOffset,
|
|---|
| 43 | final @NotNull RandomAccessReader reader,
|
|---|
| 44 | final int tagId,
|
|---|
| 45 | final int byteCount) throws IOException
|
|---|
| 46 | {
|
|---|
| 47 | switch (tagId) {
|
|---|
| 48 | //case TAG_XMP:
|
|---|
| 49 | // new XmpReader().extract(reader.getBytes(tagOffset, byteCount), _metadata);
|
|---|
| 50 | // return true;
|
|---|
| 51 | case TAG_PHOTOSHOP_IMAGE_RESOURCES:
|
|---|
| 52 | new PhotoshopReader().extract(new SequentialByteArrayReader(reader.getBytes(tagOffset, byteCount)), byteCount, _metadata);
|
|---|
| 53 | return true;
|
|---|
| 54 | case TAG_ICC_PROFILES:
|
|---|
| 55 | new IccReader().extract(new ByteArrayReader(reader.getBytes(tagOffset, byteCount)), _metadata);
|
|---|
| 56 | return true;
|
|---|
| 57 | }
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 | return super.customProcessTag(tagOffset, processedIfdOffsets, tiffHeaderOffset, reader, tagId, byteCount);
|
|---|
| 61 | }
|
|---|
| 62 | }
|
|---|