Note that there are some explanatory texts on larger screens.

plurals
  1. POTiff tiled : how to read a specific tile?
    primarykey
    data
    text
    <p>I have a tiled imaged. I'm able to read metadata, so I know tile dimensions; but I don't know how to read a specific tile. I have these questions :</p> <ul> <li><p>Suppose my tiff is composed of 128x128 tile, how can I read the tile positioned at 0,0 (x,y)? </p></li> <li><p>How many tiles are present in my tiff file?</p></li> </ul> <p>I try to develop a code to manage a single tile but I don't know how to identify a specific tile position. </p> <pre><code>IImageMetadata metadata = Sanselan.getMetadata(imageFile); TiffDirectory tiffDirectory = ((TiffImageMetadata) metadata).findDirectory(TiffDirectoryConstants.DIRECTORY_TYPE_ROOT); ByteSourceFile byteSource = new ByteSourceFile(imageFile); ArrayList&lt;?&gt; elements = tiffDirectory.getTiffRawImageDataElements(); TiffImageData.Data data[] = new TiffImageData.Data[elements.size()]; for (int i = 0; i &lt; elements.size(); i++) { TiffDirectory.ImageDataElement element = (TiffDirectory.ImageDataElement) elements.get(i); byte bytes[] = byteSource.getBlock(element.offset, element.length); data[i] = new TiffImageData.Data(element.offset, element.length, bytes); } TiffField tileWidthField = tiffDirectory.findField(TiffTagConstants.TIFF_TAG_TILE_WIDTH); if (null == tileWidthField) throw new ImageReadException("Can't find tile width field."); int tileWidth = tileWidthField.getIntValue(); TiffField tileLengthField = tiffDirectory.findField(TiffTagConstants.TIFF_TAG_TILE_LENGTH); if (null == tileLengthField) throw new ImageReadException("Can't find tile length field."); int tileLength = tileLengthField.getIntValue(); TiffImageData.Tiles tile = new TiffImageData.Tiles(data, tileWidth, tileLength); </code></pre> <p>I'm using <a href="http://incubator.apache.org/sanselan/site/index.html" rel="nofollow">Sanselan</a> from Apache incubator to make these operations.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload