#403 Support for uncommon PSD resource magic: MeSa, PHUT, AgHg and DCSR

This commit is contained in:
Harald Kuhr
2018-01-06 21:07:15 +01:00
parent fb3c5f8440
commit c8a19418eb
7 changed files with 39 additions and 17 deletions

View File

@@ -42,6 +42,13 @@ public interface PSD {
/** PSD image resource marker "8BIM". */
int RESOURCE_TYPE = ('8' << 24) + ('B' << 16) + ('I' << 8) + 'M';
// http://fileformats.archiveteam.org/wiki/Photoshop_Image_Resources
// However, ExifTool says ImageReady is PHUT and PhotoDeluxe is MeSa... :-/
int RESOURCE_TYPE_IMAGEREADY = ('M' << 24) + ('e' << 16) + ('S' << 8) + 'a';
int RESOURCE_TYPE_PHOTODELUXE = ('P' << 24) + ('H' << 16) + ('U' << 8) + 'T';
int RESOURCE_TYPE_LIGHTROOM = ('A' << 24) + ('g' << 16) + ('H' << 8) + 'g';
int RESOURCE_TYPE_DCSR = ('D' << 24) + ('C' << 16) + ('S' << 8) + 'R';
/** IPTC image resource id. */
int RES_IPTC_NAA = 0x0404;

View File

@@ -64,9 +64,17 @@ public final class PSDReader extends MetadataReader {
while (true) {
try {
int type = input.readInt();
if (type != PSD.RESOURCE_TYPE) {
throw new IIOException(String.format("Wrong image resource type, expected '8BIM': '%08x'", type));
switch (type) {
case PSD.RESOURCE_TYPE_IMAGEREADY:
case PSD.RESOURCE_TYPE_PHOTODELUXE:
case PSD.RESOURCE_TYPE_LIGHTROOM:
case PSD.RESOURCE_TYPE_DCSR:
// TODO: Warning for these types!
case PSD.RESOURCE_TYPE:
break;
default:
throw new IIOException(String.format("Wrong image resource type, expected '8BIM': '%08x'", type));
}
short id = input.readShort();