public int getCompressionMode() { return adaptee.getCompressionMode(); }
static boolean isRLE(final ImageWriteParam param) { return param != null && param.getCompressionMode() == MODE_EXPLICIT && "RLE".equals(param.getCompressionType()); } }
static int getCompressionType(final ImageWriteParam param) { if (param == null || param.getCompressionMode() != MODE_EXPLICIT || param.getCompressionType() == null || param.getCompressionType().equals("None")) { return TIFFBaseline.COMPRESSION_NONE;
private TIFFImageMetadata initMeta(final Directory ifd, final ImageTypeSpecifier imageType, final ImageWriteParam param) { Validate.notNull(imageType, "imageType"); Map<Integer, Entry> entries = new LinkedHashMap<>(ifd != null ? ifd.size() + 10 : 20); if (ifd != null) { for (Entry entry : ifd) { entries.put((Integer) entry.getIdentifier(), entry); } } int compression; if ((param == null || param.getCompressionMode() == TIFFImageWriteParam.MODE_COPY_FROM_METADATA) && ifd != null && ifd.getEntryById(TIFF.TAG_COMPRESSION) != null) { compression = ((Number) ifd.getEntryById(TIFF.TAG_COMPRESSION).getValue()).intValue(); } else { compression = TIFFImageWriteParam.getCompressionType(param); } int photometricInterpretation = getPhotometricInterpretation(imageType.getColorModel(), compression); entries.put(TIFF.TAG_PHOTOMETRIC_INTERPRETATION, new TIFFEntry(TIFF.TAG_PHOTOMETRIC_INTERPRETATION, TIFF.TYPE_SHORT, photometricInterpretation)); // TODO: Set values from param if != null + combined values... return new TIFFImageMetadata(entries.values()); }
private ImageWriteParam copyParams(final ImageWriteParam param, final ImageWriter writer) { if (param == null) { return null; } // Always safe ImageWriteParam writeParam = writer.getDefaultWriteParam(); writeParam.setSourceSubsampling(param.getSourceXSubsampling(), param.getSourceYSubsampling(), param.getSubsamplingXOffset(), param.getSubsamplingYOffset()); writeParam.setSourceRegion(param.getSourceRegion()); writeParam.setSourceBands(param.getSourceBands()); // Only if canWriteCompressed() writeParam.setCompressionMode(param.getCompressionMode()); if (param.getCompressionMode() == ImageWriteParam.MODE_EXPLICIT) { writeParam.setCompressionQuality(param.getCompressionQuality()); } return writeParam; }
if (param.getCompressionMode() == ImageWriteParam.MODE_EXPLICIT) { deflateSetting = Deflater.BEST_COMPRESSION - Math.round((Deflater.BEST_COMPRESSION - 1) * param.getCompressionQuality());
public int getCompressionMode() { return adaptee.getCompressionMode(); }
public int getCompressionMode() { return adaptee.getCompressionMode(); }
public int getCompressionMode() { return adaptee.getCompressionMode(); }
public int getCompressionMode() { return adaptee.getCompressionMode(); }
if ((param == null || param.getCompressionMode() == TIFFImageWriteParam.MODE_COPY_FROM_METADATA) && image.getMetadata() != null && metadata.getIFD().getEntryById(TIFF.TAG_COMPRESSION) != null) { compression = ((Number) metadata.getIFD().getEntryById(TIFF.TAG_COMPRESSION).getValue()).intValue();
public TIFFDeflater(String compressionType, int compressionTagValue, ImageWriteParam param, int predictorValue) { super(compressionType, compressionTagValue, true); this.predictor = predictorValue; // Set the deflate level. int deflateLevel; if(param != null && param.getCompressionMode() == ImageWriteParam.MODE_EXPLICIT) { float quality = param.getCompressionQuality(); deflateLevel = (int)(1 + 8*quality); } else { deflateLevel = Deflater.DEFAULT_COMPRESSION; } this.deflater = new Deflater(deflateLevel); }
public TIFFDeflater(String compressionType, int compressionTagValue, ImageWriteParam param, int predictorValue) { super(compressionType, compressionTagValue, true); this.predictor = predictorValue; // Set the deflate level. int deflateLevel; if(param != null && param.getCompressionMode() == ImageWriteParam.MODE_EXPLICIT) { float quality = param.getCompressionQuality(); deflateLevel = (int)(1 + 8*quality); } else { deflateLevel = Deflater.DEFAULT_COMPRESSION; } this.deflater = new Deflater(deflateLevel); }
public TIFFDeflater(String compressionType, int compressionTagValue, ImageWriteParam param, int predictorValue) { super(compressionType, compressionTagValue, true); this.predictor = predictorValue; // Set the deflate level. int deflateLevel; if(param != null && param.getCompressionMode() == ImageWriteParam.MODE_EXPLICIT) { float quality = param.getCompressionQuality(); deflateLevel = (int)(1 + 8*quality); } else { deflateLevel = Deflater.DEFAULT_COMPRESSION; } this.deflater = new Deflater(deflateLevel); }
public TIFFDeflater(String compressionType, int compressionTagValue, ImageWriteParam param, int predictorValue) { super(compressionType, compressionTagValue, true); this.predictor = predictorValue; // Set the deflate level. int deflateLevel; if(param != null && param.getCompressionMode() == ImageWriteParam.MODE_EXPLICIT) { float quality = param.getCompressionQuality(); deflateLevel = (int)(1 + 8*quality); } else { deflateLevel = Deflater.DEFAULT_COMPRESSION; } this.deflater = new Deflater(deflateLevel); }
static int getCompressionType(final ImageWriteParam param) { if (param == null || param.getCompressionMode() != MODE_EXPLICIT || param.getCompressionType().equals("None")) { return TIFFBaseline.COMPRESSION_NONE;
@Override public void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param) throws IOException { RenderedImage img = image.getRenderedImage(); if (stream == null) { throw new IOException("Set an output first!"); } if (param == null) { param = getDefaultWriteParam(); } Rectangle sourceRegion = new Rectangle(0, 0, img.getWidth(), img.getHeight()); if (param.getSourceRegion() != null) { sourceRegion = sourceRegion.intersection(param.getSourceRegion()); } Raster raster = img.getData(sourceRegion); int quality = 85; if (param.getCompressionMode() == ImageWriteParam.MODE_EXPLICIT) { quality = (int) (param.getCompressionQuality() * 100); } try { stream.write(lib.encode(raster, quality).array()); } catch (TurboJpegException e) { throw new IOException(e); } } }
private TIFFImageMetadata initMeta(final Directory ifd, final ImageTypeSpecifier imageType, final ImageWriteParam param) { Validate.notNull(imageType, "imageType"); Map<Integer, Entry> entries = new LinkedHashMap<>(ifd != null ? ifd.size() + 10 : 20); if (ifd != null) { for (Entry entry : ifd) { entries.put((Integer) entry.getIdentifier(), entry); } } int compression; if ((param == null || param.getCompressionMode() == TIFFImageWriteParam.MODE_COPY_FROM_METADATA) && ifd != null && ifd.getEntryById(TIFF.TAG_COMPRESSION) != null) { compression = ((Number) ifd.getEntryById(TIFF.TAG_COMPRESSION).getValue()).intValue(); } else { compression = TIFFImageWriteParam.getCompressionType(param); } int photometricInterpretation = getPhotometricInterpretation(imageType.getColorModel(), compression); entries.put(TIFF.TAG_PHOTOMETRIC_INTERPRETATION, new TIFFEntry(TIFF.TAG_PHOTOMETRIC_INTERPRETATION, TIFF.TYPE_SHORT, photometricInterpretation)); // TODO: Set values from param if != null + combined values... return new TIFFImageMetadata(entries.values()); }
bmpVersion = BMPConstants.VERSION_3; if(param.getCompressionMode() == ImageWriteParam.MODE_EXPLICIT) { String compressionType = param.getCompressionType(); compression =
bmpVersion = BMPConstants.VERSION_3; if(param.getCompressionMode() == ImageWriteParam.MODE_EXPLICIT) { String compressionType = param.getCompressionType(); compression =