Return-Path: owner-tiff@olympiakos.com
Return-Path: <owner-tiff@olympiakos.com>
Received: from localhost (localhost [127.0.0.1])
	by at1895.spb.edu (8.12.1/8.12.1/Debian -1) with ESMTP id fAKBHD9F001262
	for <dron@localhost>; Tue, 20 Nov 2001 14:20:39 +0300
Received: from eudoramail.com [209.185.123.45]
	by localhost with POP3 (fetchmail-5.9.0)
	for dron@localhost (single-drop); Tue, 20 Nov 2001 14:20:39 +0300 (MSK)
Received: from gate7.olympiakos.com ([207.176.88.85]) by shared1-mail.whowhere.com; Tue Nov 20 03:09:52 2001
Received: from localhost (daemon@localhost)
	by gate7.olympiakos.com (8.9.3/8.9.3) with SMTP id GAA15605;
	Tue, 20 Nov 2001 06:01:20 -0500
Received: by gate7.olympiakos.com (bulk_mailer v1.9); Tue, 20 Nov 2001 05:59:40 -0500
Received: (from majordom@localhost)
	by gate7.olympiakos.com (8.9.3/8.9.3) id FAA15573
	for tiff-outgoing; Tue, 20 Nov 2001 05:59:40 -0500
X-Authentication-Warning: gate7.olympiakos.com: majordom set sender to owner-tiff@olympiakos.com using -f
Received: from s14.mcn.mc (s14.mcn.mc [194.133.11.14])
	by gate7.olympiakos.com (8.9.3/8.9.3) with ESMTP id FAA15570
	for <tiff@olympiakos.com>; Tue, 20 Nov 2001 05:59:35 -0500
Received: from [192.168.244.177] (gw.binuscan.com [195.101.216.90])
	by s14.mcn.mc (8.12.1/8.12.1) with ESMTP id fAKAxQ12001248
	for <tiff@olympiakos.com>; Tue, 20 Nov 2001 11:59:27 +0100 (MET)
User-Agent: Microsoft-Entourage/9.0.2509
Date: Tue, 20 Nov 2001 12:01:15 +0100
Subject: Re: How to display *tiled* RGB TIFFs?
From: Bruno LEDOUX <bruno_ledoux@binuscan.com>
To: "tiff@olympiakos.com" <tiff@olympiakos.com>
Message-ID: <B81FF68B.9432%bruno_ledoux@binuscan.com>
In-Reply-To: <3BFA26D7.147B5D07@geoinform.fh-mainz.de>
Mime-version: 1.0
Content-type: text/plain; charset="US-ASCII"
Content-transfer-encoding: 7bit
Sender: owner-tiff@olympiakos.com
Precedence: bulk
Status: RO
Content-Length: 2512
Lines: 83

On 20/11/01 10:48, "Ben Fischer" <fischer@geoinform.fh-mainz.de> wrote:

Hi Ben,

TIFF library fully supports Tiled TIFFs in any of the pixels flavors, we
have been using it for years with this kind of images without any problems.
Concerning your problem I think it is simply a coding problem whichj causes
a buffer overflow (see my comments below),

Bye,

Bruno

> I have a problem with displaying RGB(A) images that are tiled.
> First of all: Is the TIFFReadTile command correctly able to read
> tiled RGB images?
Yeap !
> 
> 8 bit Grayscale images are no problem, but the tiles get
> messed up when I try to display RGB images.
> 
> I use this to read the tiles:
> 
> tdata_t buffer = _TIFFmalloc( TIFFTileSize( mpData->mpTiffFile ) );
> if ( NULL == buffer )
>       return false;
> 
> uint32 pixels_tile = mpData->mTileWidth * mpData->mTileHeight;

Shouldn't you multiply by the number of chanels (3-> RGB / 4->RGBA) too ?
You should handle the case of 16bits images too if you are likely to open
3rd parts tiled images.

> uint32 x = j * mpData->mTileWidth;
> uint32 y = i * mpData->mTileHeight;
> TIFFReadTile( mpData->mpTiffFile, buffer, x, y, 0, 0 );
> 
> unsigned char* ptr = new unsigned char [pixels_tile];
> if ( 0 == ptr )
>       return false;
> unsigned char* ptr_begin = ptr;
> unsigned char* raster = ( unsigned char* ) buffer;
> uint32 k;
> for ( k = 0; k < pixels_tile; ++k )
>      *ptr++ = *raster++;
> delete mpData->mpTileTable[i][j];
> mpData->mpTileTable[i][j] = ptr_begin;
> _TIFFfree( buffer );
> 
> 
> And then I use this to display them:
> 
> for ( int row = mTileOffsetY; row < max_index_y; ++row )
> {
> for ( int column = mTileOffsetX; column < max_index_x; ++column )
> {            
> glDrawPixels( ( GLsizei ) pImage->GetTileWidth(),
>               ( GLsizei ) pImage->GetTileHeight(),
>                 GL_RGB,
>                 GL_UNSIGNED_BYTE,
>               ( GLvoid* ) pImage->GetTile( row, column ));
> 
> glBitmap( 0, 0, 0.0f, 0.0f, move_x,
>           0.0f, NULL );
> }
> glBitmap( 0, 0, 0.0f, 0.0f,
>                 -mTilesX *  move_x,
>                 -move_y, NULL );
> }
> 
> Any ideas what I am doing wrong?
> 
> Thanks,
> 
> Ben Fischer
> 
> To subscribe or unsubscribe email tiff-request@olympiakos.com with subscribe
> or unsubscribe in the email body.  Libtiff home page: http://www.libtiff.org
> 


To subscribe or unsubscribe email tiff-request@olympiakos.com with subscribe
or unsubscribe in the email body.  Libtiff home page: http://www.libtiff.org

