Java Code Examples for javax.imageio.plugins.tiff.BaselineTIFFTagSet#COMPRESSION_NONE
The following examples show how to use
javax.imageio.plugins.tiff.BaselineTIFFTagSet#COMPRESSION_NONE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TIFFImageWriter.java From Bytecoder with Apache License 2.0 | 5 votes |
public boolean canReplacePixels(int imageIndex) throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } TIFFIFD rootIFD = readIFD(imageIndex); TIFFField f = rootIFD.getTIFFField(BaselineTIFFTagSet.TAG_COMPRESSION); int compression = f.getAsInt(0); return compression == BaselineTIFFTagSet.COMPRESSION_NONE; }
Example 2
Source File: TIFFImageReader.java From Bytecoder with Apache License 2.0 | 5 votes |
private int getCompression() { TIFFField f = imageMetadata.getTIFFField(BaselineTIFFTagSet.TAG_COMPRESSION); if (f == null) { return BaselineTIFFTagSet.COMPRESSION_NONE; } else { return f.getAsInt(0); } }
Example 3
Source File: TIFFImageReader.java From Bytecoder with Apache License 2.0 | 5 votes |
public boolean isRandomAccessEasy(int imageIndex) throws IOException { if (currIndex != -1) { seekToImage(currIndex); return getCompression() == BaselineTIFFTagSet.COMPRESSION_NONE; } else { return false; } }
Example 4
Source File: TIFFImageWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public boolean canReplacePixels(int imageIndex) throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } TIFFIFD rootIFD = readIFD(imageIndex); TIFFField f = rootIFD.getTIFFField(BaselineTIFFTagSet.TAG_COMPRESSION); int compression = f.getAsInt(0); return compression == BaselineTIFFTagSet.COMPRESSION_NONE; }
Example 5
Source File: TIFFImageReader.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private int getCompression() { TIFFField f = imageMetadata.getTIFFField(BaselineTIFFTagSet.TAG_COMPRESSION); if (f == null) { return BaselineTIFFTagSet.COMPRESSION_NONE; } else { return f.getAsInt(0); } }
Example 6
Source File: TIFFImageReader.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public boolean isRandomAccessEasy(int imageIndex) throws IOException { if (currIndex != -1) { seekToImage(currIndex); return getCompression() == BaselineTIFFTagSet.COMPRESSION_NONE; } else { return false; } }
Example 7
Source File: TIFFImageWriter.java From Bytecoder with Apache License 2.0 | 4 votes |
public void prepareReplacePixels(int imageIndex, Rectangle region) throws IOException { synchronized(replacePixelsLock) { // Check state and parameters vis-a-vis ImageWriter specification. if (stream == null) { throw new IllegalStateException("Output not set!"); } if (region == null) { throw new IllegalArgumentException("region == null!"); } if (region.getWidth() < 1) { throw new IllegalArgumentException("region.getWidth() < 1!"); } if (region.getHeight() < 1) { throw new IllegalArgumentException("region.getHeight() < 1!"); } if (inReplacePixelsNest) { throw new IllegalStateException ("In nested call to prepareReplacePixels!"); } // Read the IFD for the pixel replacement index. TIFFIFD replacePixelsIFD = readIFD(imageIndex); // Ensure that compression is "none". TIFFField f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_COMPRESSION); int compression = f.getAsInt(0); if (compression != BaselineTIFFTagSet.COMPRESSION_NONE) { throw new UnsupportedOperationException ("canReplacePixels(imageIndex) == false!"); } // Get the image dimensions. f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_WIDTH); if(f == null) { throw new IIOException("Cannot read ImageWidth field."); } int w = f.getAsInt(0); f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_LENGTH); if(f == null) { throw new IIOException("Cannot read ImageHeight field."); } int h = f.getAsInt(0); // Create image bounds. Rectangle bounds = new Rectangle(0, 0, w, h); // Intersect region with bounds. region = region.intersection(bounds); // Check for empty intersection. if(region.isEmpty()) { throw new IIOException("Region does not intersect image bounds"); } // Save the region. replacePixelsRegion = region; // Get the tile offsets. f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_TILE_OFFSETS); if(f == null) { f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_STRIP_OFFSETS); } replacePixelsTileOffsets = f.getAsLongs(); // Get the byte counts. f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_TILE_BYTE_COUNTS); if(f == null) { f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_STRIP_BYTE_COUNTS); } replacePixelsByteCounts = f.getAsLongs(); replacePixelsOffsetsPosition = replacePixelsIFD.getStripOrTileOffsetsPosition(); replacePixelsByteCountsPosition = replacePixelsIFD.getStripOrTileByteCountsPosition(); // Get the image metadata. replacePixelsMetadata = new TIFFImageMetadata(replacePixelsIFD); // Save the image index. replacePixelsIndex = imageIndex; // Set the pixel replacement flag. inReplacePixelsNest = true; } }
Example 8
Source File: TIFFLSBCompressor.java From Bytecoder with Apache License 2.0 | 4 votes |
public TIFFLSBCompressor() { super("", BaselineTIFFTagSet.COMPRESSION_NONE, true); }
Example 9
Source File: TIFFNullCompressor.java From Bytecoder with Apache License 2.0 | 4 votes |
public TIFFNullCompressor() { super("", BaselineTIFFTagSet.COMPRESSION_NONE, true); }
Example 10
Source File: TIFFImageWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void prepareReplacePixels(int imageIndex, Rectangle region) throws IOException { synchronized(replacePixelsLock) { // Check state and parameters vis-a-vis ImageWriter specification. if (stream == null) { throw new IllegalStateException("Output not set!"); } if (region == null) { throw new IllegalArgumentException("region == null!"); } if (region.getWidth() < 1) { throw new IllegalArgumentException("region.getWidth() < 1!"); } if (region.getHeight() < 1) { throw new IllegalArgumentException("region.getHeight() < 1!"); } if (inReplacePixelsNest) { throw new IllegalStateException ("In nested call to prepareReplacePixels!"); } // Read the IFD for the pixel replacement index. TIFFIFD replacePixelsIFD = readIFD(imageIndex); // Ensure that compression is "none". TIFFField f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_COMPRESSION); int compression = f.getAsInt(0); if (compression != BaselineTIFFTagSet.COMPRESSION_NONE) { throw new UnsupportedOperationException ("canReplacePixels(imageIndex) == false!"); } // Get the image dimensions. f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_WIDTH); if(f == null) { throw new IIOException("Cannot read ImageWidth field."); } int w = f.getAsInt(0); f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_LENGTH); if(f == null) { throw new IIOException("Cannot read ImageHeight field."); } int h = f.getAsInt(0); // Create image bounds. Rectangle bounds = new Rectangle(0, 0, w, h); // Intersect region with bounds. region = region.intersection(bounds); // Check for empty intersection. if(region.isEmpty()) { throw new IIOException("Region does not intersect image bounds"); } // Save the region. replacePixelsRegion = region; // Get the tile offsets. f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_TILE_OFFSETS); if(f == null) { f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_STRIP_OFFSETS); } replacePixelsTileOffsets = f.getAsLongs(); // Get the byte counts. f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_TILE_BYTE_COUNTS); if(f == null) { f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_STRIP_BYTE_COUNTS); } replacePixelsByteCounts = f.getAsLongs(); replacePixelsOffsetsPosition = replacePixelsIFD.getStripOrTileOffsetsPosition(); replacePixelsByteCountsPosition = replacePixelsIFD.getStripOrTileByteCountsPosition(); // Get the image metadata. replacePixelsMetadata = new TIFFImageMetadata(replacePixelsIFD); // Save the image index. replacePixelsIndex = imageIndex; // Set the pixel replacement flag. inReplacePixelsNest = true; } }
Example 11
Source File: TIFFLSBCompressor.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public TIFFLSBCompressor() { super("", BaselineTIFFTagSet.COMPRESSION_NONE, true); }
Example 12
Source File: TIFFNullCompressor.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public TIFFNullCompressor() { super("", BaselineTIFFTagSet.COMPRESSION_NONE, true); }