Even, Thank you very much !<br>
<br>
With the two creation options : PHOTOMETRIC=RGB and ALPHA=NO, I obtain the same behaviour I whish.<br>
<br>
Can you explain me where you found this answer ? (to help me to become more autonomous with GDAL)<br>
<br>
Thank you again<br>
<br>
Nicky<br><br><br><br><div class="gmail_quote">2011/4/18 Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@mines-paris.org">even.rouault@mines-paris.org</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">Selon Nicolas Mayer <<a href="mailto:nmayer31000@gmail.com">nmayer31000@gmail.com</a>>:<br>
<br>
</div><div class="im">> Even, thank you very much for answering me so quicly<br>
><br>
> With the PHOTOMETRIC creation option to MINISBLACK, I get now :<br>
> Band 1 Block=100x20 Type=Byte, ColorInterp=Gray<br>
> Band 2 Block=100x20 Type=Byte, ColorInterp=Undefined<br>
> Band 3 Block=100x20 Type=Byte, ColorInterp=Undefined<br>
> Band 4 Block=100x20 Type=Byte, ColorInterp=Undefined<br>
><br>
> Does this option change anything in the metadatas or in the headers of the<br>
> written file ?<br>
<br>
</div>Yes of course, otherwise how would you explain you get a difference ;-) ? This<br>
change the value of the PHOTOMETRIC tiff tag in TIFF file.<br>
<div class="im"><br>
><br>
> But I try to make the same thing as an exemple file I have, which has this<br>
> interpretation whith gdalinfo (GDAL 1.7.3) :<br>
><br>
> Metadata:<br>
> TIFFTAG_IMAGEDESCRIPTION=B3 B2 B1 B4<br>
> TIFFTAG_DATETIME=20050824 18:08:22<br>
> AREA_OR_POINT=Point<br>
> Image Structure Metadata:<br>
> INTERLEAVE=BAND<br>
> Corner Coordinates:<br>
> Upper Left ( 0.0, 0.0)<br>
> Lower Left ( 0.0, 3000.0)<br>
> Upper Right ( 3000.0, 0.0)<br>
> Lower Right ( 3000.0, 3000.0)<br>
> Center ( 1500.0, 1500.0)<br>
> Band 1 Block=3000x500 Type=Byte, ColorInterp=Red<br>
> Band 2 Block=3000x500 Type=Byte, ColorInterp=Green<br>
> Band 3 Block=3000x500 Type=Byte, ColorInterp=Blue<br>
> Band 4 Block=3000x500 Type=Byte, ColorInterp=Undefined<br>
><br>
> My goal is to have an "RGB-Undefined" color interpretation.<br>
> Have you any idea of the creation option (or driver option ?) to set to have<br>
> the same color interpretations ?<br>
<br>
</div>Actually after looking more precisely at the code and a bit of testing, I see<br>
you can obtain the behaviour you wish by specifying both PHOTOMETRIC=RGB and<br>
ALPHA=NO. (ALPHA=NO only will not be sufficient)<br>
<div><div></div><div class="h5"><br>
><br>
> Thank you in advance<br>
><br>
> Nicky<br>
><br>
><br>
><br>
> 2011/4/18 Even Rouault <<a href="mailto:even.rouault@mines-paris.org">even.rouault@mines-paris.org</a>><br>
><br>
> > Selon Nicolas Mayer <<a href="mailto:nmayer31000@gmail.com">nmayer31000@gmail.com</a>>:<br>
> ><br>
> > Retry by setting the PHOTOMETRIC creation option to MINISBLACK. Otherwise,<br>
> > by<br>
> > default, without specifying it, GDAL assumes that the PHOTOMETRIC is RGB<br>
> > and<br>
> > that the 4th band is an alpha band.<br>
> ><br>
> > You should get :<br>
> > Band 1 Block=100x20 Type=Byte, ColorInterp=Gray<br>
> > Band 2 Block=100x20 Type=Byte, ColorInterp=Undefined<br>
> > Band 3 Block=100x20 Type=Byte, ColorInterp=Undefined<br>
> > Band 4 Block=100x20 Type=Byte, ColorInterp=Undefined<br>
> ><br>
> > There's no way in the TIFF format to really specify the color<br>
> > interpretation of<br>
> > each band. The way GDAL builds the color interpretation when reading a TIFF<br>
> > file<br>
> > is a combination of the value of the PHOTOMETRIC and EXTRASAMPLES tag.<br>
> ><br>
> > > Hello<br>
> > ><br>
> > > I have a problem with the geotiff (GTiff) driver.<br>
> > ><br>
> > > I create a 4-bands raster image in a c++ program. The fourth band was<br>
> > > considered as an alpha band in the geotiff image (actually, it is near<br>
> > > infrared : NIR)<br>
> > ><br>
> > > $ gdalinfo new_geotiff.tif<br>
> > > Driver: GTiff/GeoTIFF<br>
> > > Files: new__geotiff.tif<br>
> > > Size is 100, 100<br>
> > > (...)<br>
> > > Band 1 Block=100x20 Type=Byte, ColorInterp=Red<br>
> > > Mask Flags: PER_DATASET ALPHA<br>
> > > Band 2 Block=100x20 Type=Byte, ColorInterp=Green<br>
> > > Mask Flags: PER_DATASET ALPHA<br>
> > > Band 3 Block=100x20 Type=Byte, ColorInterp=Blue<br>
> > > Mask Flags: PER_DATASET ALPHA<br>
> > > Band 4 Block=100x20 Type=Byte, ColorInterp=Alpha<br>
> > ><br>
> > > How to remove the Color interpretation 'alpha' and the mask flags ?<br>
> > ><br>
> > > I want to have :<br>
> > ><br>
> > > Band 1 Block=100x20 Type=Byte, ColorInterp=Red<br>
> > > Band 2 Block=100x20 Type=Byte, ColorInterp=Green<br>
> > > Band 3 Block=100x20 Type=Byte, ColorInterp=Blue<br>
> > > Band 4 Block=100x20 Type=Byte, ColorInterp=Undefined<br>
> > ><br>
> > > I already tryed :<br>
> > > pDS->GetRasterBand(4)->SetColorInterpretation(GCI_Undefined );<br>
> > ><br>
> > > I tryed too to set the creation option : "ALPHA" to "NO".<br>
> > ><br>
> > ><br>
> > > Thanks in advance for any help.<br>
> > ><br>
> > > Nicky<br>
> > ><br>
> ><br>
> ><br>
> ><br>
><br>
<br>
<br>
</div></div></blockquote></div><br>