POV-Ray : Newsgroups : povray.bugreports : 24-bit TIFF read error Server Time
14 May 2024 04:19:42 EDT (-0400)
  24-bit TIFF read error (Message 1 to 2 of 2)  
From: Ray Gardener
Subject: 24-bit TIFF read error
Date: 21 Apr 2003 08:43:02
Message: <3ea3e756$1@news.povray.org>
Turns out POV-Ray 3.5 misinterprets the
TIFFReadRGBAImage function in libtiff.
It assumes that returned scanlines are
topdown when in fact they are bottom up.
This causes 24-bit TIFF imagemaps to appear
vertically flipped.

The code fragment in tiff_pov.cpp, in function
Read_Tiff_Image(), near line 235 is currently:


   Image->data.rgb8_lines[i].blue   = (unsigned char
*)POV_MALLOC(width,"TIFF Image line");
   Image->data.rgb8_lines[i].green  = (unsigned char
*)POV_MALLOC(width,"TIFF Image line");
   Image->data.rgb8_lines[i].red    = (unsigned char
*)POV_MALLOC(width,"TIFF Image line");
   Image->data.rgb8_lines[i].transm = (unsigned char
*)POV_MALLOC(width,"TIFF Image line");
   for (j=0,l=0;j<width;j++)
   {
    Image->data.rgb8_lines[i].blue[j]   = (unsigned char)TIFFGetB(abgr);
    Image->data.rgb8_lines[i].green[j]  = (unsigned char)TIFFGetG(abgr);
    Image->data.rgb8_lines[i].red[j]    = (unsigned char)TIFFGetR(abgr);
    Image->data.rgb8_lines[i].transm[j] = 255 - (unsigned
char)TIFFGetA(abgr);


It should read:

   int n = (height-1)-i;
   Image->data.rgb8_lines[n].blue   = (unsigned char *)POV_MALLOC(width,
"TIFF Image line");
   Image->data.rgb8_lines[n].green  = (unsigned char *)POV_MALLOC(width,
"TIFF Image line");
   Image->data.rgb8_lines[n].red    = (unsigned char *)POV_MALLOC(width,
"TIFF Image line");
   Image->data.rgb8_lines[n].transm = (unsigned char *)POV_MALLOC(width,
"TIFF Image line");
   for (j=0,l=0;j<width;j++)
   {
    Image->data.rgb8_lines[n].blue[j]   = (unsigned char)TIFFGetB(abgr);
    Image->data.rgb8_lines[n].green[j]  = (unsigned char)TIFFGetG(abgr);
    Image->data.rgb8_lines[n].red[j]    = (unsigned char)TIFFGetR(abgr);
    Image->data.rgb8_lines[n].transm[j] = 255 - (unsigned
char)TIFFGetA(abgr);


--
Ray Gardener
Daylon Graphics Ltd.
"Heightfield modeling perfected"


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: 24-bit TIFF read error
Date: 21 Apr 2003 09:26:02
Message: <3ea3f16a$1@news.povray.org>
In article <3ea3e756$1@news.povray.org> , "Ray Gardener" 
<ray### [at] daylongraphicscom> wrote:

> Turns out POV-Ray 3.5 misinterprets the
> TIFFReadRGBAImage function in libtiff.
> It assumes that returned scanlines are
> topdown when in fact they are bottom up.
> This causes 24-bit TIFF imagemaps to appear
> vertically flipped.

Will be fixed in POV-Ray 3.51.

    Thorsten

____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.