Tabnine Logo
TIFFDecodeParam
Code IndexAdd Tabnine to your IDE (free)

How to use
TIFFDecodeParam
in
org.apache.xmlgraphics.image.codec.tiff

Best Java code snippets using org.apache.xmlgraphics.image.codec.tiff.TIFFDecodeParam (Showing top 7 results out of 315)

origin: graphhopper/graphhopper

@Override
Raster generateRasterFromFile(File file, String tifName) {
  SeekableStream ss = null;
  try {
    InputStream is = new FileInputStream(file);
    ZipInputStream zis = new ZipInputStream(is);
    // find tif file in zip
    ZipEntry entry = zis.getNextEntry();
    while (entry != null && !entry.getName().equals(tifName)) {
      entry = zis.getNextEntry();
    }
    ss = SeekableStream.wrapInputStream(zis, true);
    TIFFImageDecoder imageDecoder = new TIFFImageDecoder(ss, new TIFFDecodeParam());
    return imageDecoder.decodeAsRaster();
  } catch (Exception e) {
    throw new RuntimeException("Can't decode " + tifName, e);
  } finally {
    if (ss != null)
      Helper.close(ss);
  }
}
origin: org.apache.xmlgraphics/xmlgraphics-commons

  param = new TIFFDecodeParam();
decodePaletteAsShorts = param.getDecodePaletteAsShorts();
TIFFDirectory dir = param.getIFDOffset() == null
  ? new TIFFDirectory(stream, directory)
  : new TIFFDirectory(stream, param.getIFDOffset(),
           directory);
          r[i] = param.decodeSigned16BitsTo8Bits(
            (short)colormap[i]);
          g[i] = param.decodeSigned16BitsTo8Bits(
            (short)colormap[gIndex + i]);
          b[i] = param.decodeSigned16BitsTo8Bits(
            (short)colormap[bIndex + i]);
          r[i] = param.decode16BitsTo8Bits(
            colormap[i] & 0xffff);
          g[i] = param.decode16BitsTo8Bits(
            colormap[gIndex + i] & 0xffff);
          b[i] = param.decode16BitsTo8Bits(
            colormap[bIndex + i] & 0xffff);
origin: graphhopper/graphhopper

@Override
Raster generateRasterFromFile(File file, String tifName) {
  SeekableStream ss = null;
  try {
    InputStream is = new FileInputStream(file);
    ss = SeekableStream.wrapInputStream(is, true);
    TIFFImageDecoder imageDecoder = new TIFFImageDecoder(ss, new TIFFDecodeParam());
    return imageDecoder.decodeAsRaster();
  } catch (Exception e) {
    throw new RuntimeException("Can't decode " + file.getName(), e);
  } finally {
    if (ss != null)
      close(ss);
  }
}
origin: com.graphhopper/graphhopper-core

@Override
Raster generateRasterFromFile(File file, String tifName) {
  SeekableStream ss = null;
  try {
    InputStream is = new FileInputStream(file);
    ss = SeekableStream.wrapInputStream(is, true);
    TIFFImageDecoder imageDecoder = new TIFFImageDecoder(ss, new TIFFDecodeParam());
    return imageDecoder.decodeAsRaster();
  } catch (Exception e) {
    throw new RuntimeException("Can't decode " + file.getName(), e);
  } finally {
    if (ss != null)
      close(ss);
  }
}
origin: com.graphhopper/graphhopper-core

@Override
Raster generateRasterFromFile(File file, String tifName) {
  SeekableStream ss = null;
  try {
    InputStream is = new FileInputStream(file);
    ZipInputStream zis = new ZipInputStream(is);
    // find tif file in zip
    ZipEntry entry = zis.getNextEntry();
    while (entry != null && !entry.getName().equals(tifName)) {
      entry = zis.getNextEntry();
    }
    ss = SeekableStream.wrapInputStream(zis, true);
    TIFFImageDecoder imageDecoder = new TIFFImageDecoder(ss, new TIFFDecodeParam());
    return imageDecoder.decodeAsRaster();
  } catch (Exception e) {
    throw new RuntimeException("Can't decode " + tifName, e);
  } finally {
    if (ss != null)
      Helper.close(ss);
  }
}
origin: com.rgi-corp/graphhopper

  TIFFImageDecoder imageDecoder = new TIFFImageDecoder(ss, new TIFFDecodeParam());
  raster = imageDecoder.decodeAsRaster();
} catch (Exception e) {
origin: com.graphhopper/graphhopper

  TIFFImageDecoder imageDecoder = new TIFFImageDecoder(ss, new TIFFDecodeParam());
  raster = imageDecoder.decodeAsRaster();
} catch (Exception e)
org.apache.xmlgraphics.image.codec.tiffTIFFDecodeParam

Javadoc

An instance of ImageDecodeParam for decoding images in the TIFF format.

To determine the number of images present in a TIFF file, use the getNumPages() method on the ImageDecoder object that will be used to perform the decoding. The desired page number may be passed as an argument to the ImageDecoder.decodeAsRaster)() or decodeAsRenderedImage() methods.

For TIFF Palette color images, the colorMap always has entries of short data type, the color Black being represented by 0,0,0 and White by 65536,65536,65536. In order to display these images, the default behavior is to dither the short values down to 8 bits. The dithering is done by calling the decode16BitsTo8Bits method for each short value that needs to be dithered. The method has the following implementation: byte b; short s; s = s & 0xffff; b = (byte)((s >> 8) & 0xff); If a different algorithm is to be used for the dithering, this class should be subclassed and an appropriate implementation should be provided for the decode16BitsTo8Bits method in the subclass.

If the palette contains image data that is signed short, as specified by the SampleFormat tag, the dithering is done by calling decodeSigned16BitsTo8Bits instead. The method has the following implementation: byte b; short s; b = (byte)((s + Short.MIN_VALUE) >> 8); In order to use a different algorithm for the dithering, this class should be subclassed and the method overridden.

If it is desired that the Palette be decoded such that the output image is of short data type and no dithering is performed, the setDecodePaletteAsShorts method should be used.

This class is not a committed part of the JAI API. It may be removed or changed in future releases of JAI.

Most used methods

  • <init>
    Constructs a default instance of TIFFDecodeParam.
  • decode16BitsTo8Bits
    Returns an unsigned 8 bit value computed by dithering the unsigned 16 bit value. Note that the TIFF
  • decodeSigned16BitsTo8Bits
    Returns an unsigned 8 bit value computed by dithering the signed 16 bit value. This method deals cor
  • getDecodePaletteAsShorts
    Returns true if palette entries will be decoded as shorts, resulting in an output image with short d
  • getIFDOffset
    Returns the value set by setIFDOffset() ornull if no value has been set.

Popular in Java

  • Finding current android device location
  • getApplicationContext (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • getResourceAsStream (ClassLoader)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Path (java.nio.file)
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JLabel (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now