#397 ColorSpaceType value -> name

This commit is contained in:
Harald Kuhr 2017-12-19 20:32:26 +01:00
parent 73e4eb8627
commit 910f9fafc7
2 changed files with 10 additions and 10 deletions

View File

@ -361,39 +361,39 @@ public final class TIFFImageMetadata extends AbstractMetadata {
case TIFFBaseline.PHOTOMETRIC_WHITE_IS_ZERO: case TIFFBaseline.PHOTOMETRIC_WHITE_IS_ZERO:
case TIFFBaseline.PHOTOMETRIC_BLACK_IS_ZERO: case TIFFBaseline.PHOTOMETRIC_BLACK_IS_ZERO:
case TIFFBaseline.PHOTOMETRIC_MASK: // It's really a transparency mask/alpha channel, but... case TIFFBaseline.PHOTOMETRIC_MASK: // It's really a transparency mask/alpha channel, but...
colorSpaceType.setAttribute("value", "GRAY"); colorSpaceType.setAttribute("name", "GRAY");
break; break;
case TIFFBaseline.PHOTOMETRIC_RGB: case TIFFBaseline.PHOTOMETRIC_RGB:
case TIFFBaseline.PHOTOMETRIC_PALETTE: case TIFFBaseline.PHOTOMETRIC_PALETTE:
colorSpaceType.setAttribute("value", "RGB"); colorSpaceType.setAttribute("name", "RGB");
break; break;
case TIFFExtension.PHOTOMETRIC_YCBCR: case TIFFExtension.PHOTOMETRIC_YCBCR:
colorSpaceType.setAttribute("value", "YCbCr"); colorSpaceType.setAttribute("name", "YCbCr");
break; break;
case TIFFExtension.PHOTOMETRIC_CIELAB: case TIFFExtension.PHOTOMETRIC_CIELAB:
case TIFFExtension.PHOTOMETRIC_ICCLAB: case TIFFExtension.PHOTOMETRIC_ICCLAB:
case TIFFExtension.PHOTOMETRIC_ITULAB: case TIFFExtension.PHOTOMETRIC_ITULAB:
colorSpaceType.setAttribute("value", "Lab"); colorSpaceType.setAttribute("name", "Lab");
break; break;
case TIFFExtension.PHOTOMETRIC_SEPARATED: case TIFFExtension.PHOTOMETRIC_SEPARATED:
// TODO: May be CMYK, or something else... Consult InkSet and NumberOfInks! // TODO: May be CMYK, or something else... Consult InkSet and NumberOfInks!
if (numChannelsValue == 3) { if (numChannelsValue == 3) {
colorSpaceType.setAttribute("value", "CMY"); colorSpaceType.setAttribute("name", "CMY");
} }
else { else {
colorSpaceType.setAttribute("value", "CMYK"); colorSpaceType.setAttribute("name", "CMYK");
} }
break; break;
case TIFFCustom.PHOTOMETRIC_LOGL: // ..? case TIFFCustom.PHOTOMETRIC_LOGL: // ..?
case TIFFCustom.PHOTOMETRIC_LOGLUV: case TIFFCustom.PHOTOMETRIC_LOGLUV:
colorSpaceType.setAttribute("value", "Luv"); colorSpaceType.setAttribute("name", "Luv");
break; break;
case TIFFCustom.PHOTOMETRIC_CFA: case TIFFCustom.PHOTOMETRIC_CFA:
case TIFFCustom.PHOTOMETRIC_LINEAR_RAW: // ...or is this RGB? case TIFFCustom.PHOTOMETRIC_LINEAR_RAW: // ...or is this RGB?
colorSpaceType.setAttribute("value", "3CLR"); colorSpaceType.setAttribute("name", "3CLR");
break; break;
default: default:
colorSpaceType.setAttribute("value", Integer.toHexString(numChannelsValue) + "CLR"); colorSpaceType.setAttribute("name", Integer.toHexString(numChannelsValue) + "CLR");
break; break;
} }

View File

@ -74,7 +74,7 @@ public class TIFFImageMetadataTest {
Node colorSpaceType = chroma.getFirstChild(); Node colorSpaceType = chroma.getFirstChild();
assertEquals("ColorSpaceType", colorSpaceType.getNodeName()); assertEquals("ColorSpaceType", colorSpaceType.getNodeName());
assertEquals("YCbCr", ((Element) colorSpaceType).getAttribute("value")); assertEquals("YCbCr", ((Element) colorSpaceType).getAttribute("name"));
Node numChannels = colorSpaceType.getNextSibling(); Node numChannels = colorSpaceType.getNextSibling();
assertEquals("NumChannels", numChannels.getNodeName()); assertEquals("NumChannels", numChannels.getNodeName());