Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7189073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:13:24+00:00 2026-05-28T19:13:24+00:00

I have a tiled imaged. I’m able to read metadata, so I know tile

  • 0

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 :

  • Suppose my tiff is composed of 128×128 tile, how can I read the tile positioned at 0,0 (x,y)?

  • How many tiles are present in my tiff file?

I try to develop a code to manage a single tile but I don’t know how to identify a specific tile position.

IImageMetadata metadata = Sanselan.getMetadata(imageFile);
TiffDirectory tiffDirectory = ((TiffImageMetadata) metadata).findDirectory(TiffDirectoryConstants.DIRECTORY_TYPE_ROOT);

ByteSourceFile byteSource = new ByteSourceFile(imageFile);
ArrayList<?> elements = tiffDirectory.getTiffRawImageDataElements();
TiffImageData.Data data[] = new TiffImageData.Data[elements.size()];
for (int i = 0; i < 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);

I’m using Sanselan from Apache incubator to make these operations.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:13:26+00:00Added an answer on May 28, 2026 at 7:13 pm

    The TIFF tiles are laid out in row major order so it is relatively simple to figure out which tile you need to read. For your specific question, the tile at (0,0) is tile #0. The number of tiles is calculated from:

    Horizontal_Tiles = (Image_Width + Tile_Width-1)/Tile_Width;
    Vertical_Tiles   = (Image_Height + Tile_Height-1)/Tile_Height;
    Total_Tiles      = Horizontal_Tiles * Vertical_Tiles;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a sticky footer which works, but I'm using a tiled background image
So I have a tile image tile.png and I'm trying to create a tiled
I have an NSCollectionView that contains a collection of CustomViews . Initially it tiled
I have Tile s which represent the tiles in a game's 2-dimensional world. The
Is it possible to have iOS4 specific code (ie the MKMapView overlays) in an
I have a large SVG file (approx. 60 MB, 10000x10000 pixels but with the
I have a splash screen image that I display with splash.showFullScreen() but it doesn't
I have an endlessly looping CABasicAnimation of a repeating image tile in my view:
I have the following CSS: body { margin-left:0px; margin-right:0px; margin-bottom:0px; margin-top:0px; background-image: url(../images/tile.png); background-repeat:
I have a high-resolution image that I want to use as a tiled map

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.