[Gdal-dev] Creating a color geotiff

Ed McNierney ed at topozone.com
Wed Jan 14 16:37:57 EST 2004


Brian -
 
You can call Microsoft and volunteer to fix bugs for them <g>!
 
When I encounter the same problem (and I do) I simply educate users on
an appropriate viewer choice.  In my case, I have users who actually
neither want nor need 24-bit images, but download them because they
think they'll look better than 8-bit images.  Since the data in this
case is USGS topographic maps with 13 colors on them, 8-bit images are
just fine.
 
I believe the problem is with multi-plane images.  Check the "Planar
configuration:" from tiffinfo - the problems come up in documents with
"separate image planes" (3 8-bit planes) rather than "single image
plane" documents.
 
    - Ed
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242 


  _____  

From: Brian Marchand [mailto:bmarchand at ara.com] 
Sent: Wednesday, January 14, 2004 4:13 PM
To: gdal-dev at remotesensing.org
Subject: RE: [Gdal-dev] Creating a color geotiff



Ed,

 

You are absolutely right. I read it using my GDAL based application and
the images look fine. My use for these images is mostly by my GDAL based
application, so in that sense it would be ok. However, users of this
application may do what I did so I'd like to figure out what's wrong so
the images can be viewed by the windows viewer too. I can read another
color geotiff (not created by me) with that viewer. That file appears to
be a 24 bit TIFF because it has 3 RGB bands of type Byte. 

 

Brian

 

-----Original Message-----
From: Ed McNierney [mailto:ed at topozone.com] 
Sent: Wednesday, January 14, 2004 3:54 PM
To: gdal-dev at remotesensing.org
Subject: RE: [Gdal-dev] Creating a color geotiff

 

Brian -

 

Yes, that's the one I'm talking about; in a prior life I was involved in
creating it!  It was intended as a fax viewer, and does not properly
handle many 24-bit TIFFs.  They produce exactly the symptom you
describe.

 

It sounds like your TIFF is correct - if you have Adobe Photoshop
available, that's a much more reliable color TIFF viewer, and I'll bet
the image looks fine in it.  However, it's worth asking what you intend
to do with these images, since they need to be readable by whatever the
target reader is.

 

    - Ed

Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242 

 

 

 

  _____  

From: Brian Marchand [mailto:bmarchand at ara.com] 
Sent: Wednesday, January 14, 2004 3:45 PM
To: gdal-dev at remotesensing.org
Subject: RE: [Gdal-dev] Creating a color geotiff

Ed,

 

I was using a windows viewer by Kodak. With this viewer I was able to
view other color geotiff files successfully. The image appeared to
repeat itself (in black and white) with stripes of black interleaved.

 

When I use the "create" function does the type need to match the type
that I use for the RasterIO function for a band? In this case both are
set to GDT_Byte. 

 

For instance I create the data set with;

 

GDALDataset* poDstDS = poDriver->Create(destFile, sourceGrid.GetCols(),
sourceGrid.GetRows(), 3, GDT_Byte, NULL);

 

And write bands with

 

poBandR->RasterIO( GF_Write, 0, row, nXSize, 1, scanline, nXSize, 1,
GDT_Byte, 0, 0 );

 

where scanline is a char buffer of size nXSize. Or should I be using
something like GDT_Int32 for the data set type?

 

Brian

 

 

-----Original Message-----
From: Ed McNierney [mailto:ed at topozone.com] 
Sent: Wednesday, January 14, 2004 3:21 PM
To: gdal-dev at remotesensing.org
Subject: RE: [Gdal-dev] Creating a color geotiff

 

Brian -

 

How did you conclude it was "garbage"?  There are quite a few programs
(such as the Windows "Image and Fax Viewer") that don't read them
correctly, or that fail to read certain data organization/formats.

 

    - Ed

Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242 

 

  _____  

From: Brian Marchand [mailto:bmarchand at ara.com] 
Sent: Wednesday, January 14, 2004 3:10 PM
To: gdal-dev at remotesensing.org
Subject: [Gdal-dev] Creating a color geotiff

Hello,

 

I'm trying to create geotiff files for the first time and I was
successful in creating a black and white geotiff. So I moved on to
creating a color one. I have a grid of RGB values so I created a data
set with 3 bands of type GDT_Byte.  I used RasterIO to write out a row
at a time. The result was garbage. 

 

Is there a specific order to writing out bands? I first tried writing a
row of red band, then a row of the green band, then the row of the blue
band. This didn't work so I dried writing all of rows for one band
before writing the next. Am I way off on this? How should I be doing
this?

 

Thanks in advance,

 

Brian Marchand

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20040114/4aa6ff2d/attachment.html


More information about the Gdal-dev mailing list