Пример #1
0
 /** {@inheritDoc} */
 public RenderedImage getPreviewImage(ImageInfo imageInfo, int maxWidth, int maxHeight)
     throws BadImageFileException, IOException, UnknownImageTypeException {
   final ImageMetadata metadata = imageInfo.getMetadata();
   final ImageMetadataDirectory dir = metadata.getDirectoryFor(CIFFDirectory.class);
   if (dir != null) {
     final ImageMetaValue colorSpace = dir.getValue(CIFF_COLOR_SPACE);
     ColorSpace cs = JAIContext.sRGBColorSpace;
     if (colorSpace != null)
       switch (colorSpace.getIntValue()) {
         case CIFF_COLOR_SPACE_ADOBE_RGB:
           cs = JAIContext.adobeRGBColorSpace;
           break;
       }
     final RenderedImage image =
         JPEGImageType.getImageFromBuffer(
             imageInfo.getByteBuffer(),
             dir.getValue(CIFF_PREVIEW_IMAGE_OFFSET),
             0,
             dir.getValue(CIFF_PREVIEW_IMAGE_LENGTH),
             cs,
             maxWidth,
             maxHeight);
     if (image != null) return image;
   }
   return super.getPreviewImage(imageInfo, maxWidth, maxHeight);
 }
Пример #2
0
 /** {@inheritDoc} */
 public String valueToString(ImageMetaValue value) {
   switch (value.getOwningTagID()) {
     case OLYMPUS_BLUE_BALANCE:
     case OLYMPUS_RED_BALANCE:
       return TextUtil.tenths(value.getFloatValue() / 256);
     case OLYMPUS_CS_CUSTOM_SATURATION:
       {
         final String model = getOwningMetadata().getCameraMake(true);
         if (model != null && model.contains("E-1")) {
           final long[] n = ((LongMetaValue) value).getLongValues();
           n[0] -= n[1];
           n[2] -= n[1];
           return n[0] + " (0," + n[2] + ')';
         }
         // no break;
       }
     case OLYMPUS_CS_CONTRAST_SETTING:
     case OLYMPUS_CS_PM_CONTRAST:
     case OLYMPUS_CS_PM_SATURATION:
     case OLYMPUS_CS_PM_SHARPNESS:
     case OLYMPUS_CS_SHARPNESS_SETTING:
       {
         final String[] values = value.getValues();
         if (values.length != 3) return null;
         return values[0] + " (" + values[1] + ',' + values[2] + ')';
       }
     case OLYMPUS_CS_PANORAMA_MODE:
       {
         if (value.getValueCount() != 2) break;
         final int tagID = value.getOwningTagID();
         return getTagValueLabelFor(tagID, value.getIntValue()) + ", " + value.getValues()[1];
       }
     case OLYMPUS_FOCAL_PLANE_DIAGONAL:
       return value.getStringValue() + "mm"; // TODO: localize
   }
   return super.valueToString(value);
 }