Question

We are using BitMiracle ReadRGBATile to get a tile of a multi page tiff file to bitmap. We have the following problems 1. The image quality is not good (comparing to the same image opened in Autocad). 2. Black pixels added to fill at the right and bottom of the image (looks like TILEWIDTH - IMAGEWIDTH and IMAGELENGTH - TILELENGTH). Appreciate your help

enter image description here

enter image description here

Was it helpful?

Solution

The following has solved our problem

int iWidth = tiffInput.GetField(TiffTag.IMAGEWIDTH)[0].ToInt();
int iHeight = tiffInput.GetField(TiffTag.IMAGELENGTH)[0].ToInt();

int iTile_Width = inImage.GetField(TiffTag.TILEWIDTH)[0].ToInt();
int iTile_Height = inImage.GetField(TiffTag.TILELENGTH)[0].ToInt();

for (int row = 0; row < iHeight; row += iTile_Height)
{
      for (int col = 0; col < iWidth; col += iTile_Width)
      {
          // Read the tile into an RGBA array
          if (inImage.ReadRGBATile(col, row, raster))
          {
              Bitmap bmp = TiffDataToImage(raster, iTile_Width, iTile_Height);
              //Collect all these images

          }
      }
}

Combine the image to make one image.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top