2007.08.02 16:38 "[Tiff] reading planar images using TIFFReadScanline", by Christian Henning

2007.08.04 09:02 "Re: [Tiff] reading planar images using TIFFReadScanline", by Kai-Uwe Behrmann

We always avoid TIFFReadEncodedStrip to not to unpack the data ourself.
TIFFReadScanline works correct for PLANARCONFIG_SEPARATE continously
reading the whole image, channel for channel.

I attached the according code snippet from CinePaint's tiff plug-in.

regards

Kai-Uwe Behrmann
--
developing for colour management
www.behrmann.name + www.oyranos.org + www.cinepaint.org

Am 03.08.07, 11:17 -0400 schrieb Christian Henning:

Thanks for the advise. Yes, my code can read. But I'm using TIFFReadEncodedStrip and I get the right data. I was just wondering if there is a way to read it using TIFFReadScanline?

Does anyone know if it's possible?

On 8/3/07, Kai-Uwe Behrmann <ku.b@gmx.de> wrote:

CinePaint reads Caspian.tif fine. Is your code ready for the data?

  Bits/Sample: 64
  Sample Format: IEEE floating point
with libtiff 3.8.2

Am 02.08.07, 13:45 -0400 schrieb Christian Henning:

Sorry, I should have read my email before sending. My question regarding TIFFReadScanline was in conjunction with planar images. Here as everyone knows the channels are stored subsequently. So, it made me wonder if TIFFReadScanline still works. A quite test with the caspian.tif test image results in a messed up image.

} else { /* PLANARCONFIG_SEPARATE */
  uint16 sample;
  gint start = TRUE;

if (ci->channel->drawable->bpp !=
                   (int)((float)ci->bps/8 * (float)ci->spp) && ci->bps < 64)
      g_warning ("%s:%d %s() drawables and tiffs byte depth are different %d != %01f(%01f*%01f)\n",__FILE__,__LINE__,__func__,
        ci->channel->drawable->bpp,
        (float)ci->bps/8.0* (float)ci->spp,
        (float)ci->bps/8.0, (float)ci->spp);

for (sample = 0; sample < (ci->spp + ci->extra); sample++) {
  m_new (text, char, 256, ;)
  sprintf (text, "%s '%s' plane %d ...",_("Opening"), ci->top->filename,
                  sample + 1);

gimp_progress_init (text);

m_free (text)

for (j_row = 0; j_row < ci->rows; j_row += tile_height) {
  gimp_progress_update ( (double) j_row / (double) ci->rows);
  rows = MIN (tile_height, ci->rows - j_row);

        for (g_row = 0;  g_row < rows; ++g_row) {
          TIFFReadScanline(tif, buffer + g_row * lineSize,

         (uint32)(j_row + g_row), sample);
}

      read_separate (buffer, ci, 0, j_row, ci->cols, rows, (gint)sample);
      start = FALSE;
    }
  }
}