<div dir="ltr"><div>Hi all</div><div>at last I found the problem</div><div>white bands must be filtered by the source, so the "-srcnodata" option must be used.</div><div>In my case -srcnodata "0" solved the problem and all tiff images are now mosaicked without blanc bands between them.</div>
<div>This is the correct command</div><div><br></div><div>gdalbuildvrt -hidenodata -srcnodata "0" -vrtnodata "0" test.vrt *.tif</div><div><br></div><div>Bie</div><div>pietro</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">2012/11/14 Pietro Rossin <span dir="ltr"><<a href="mailto:pierigis@gmail.com" target="_blank">pierigis@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Sorry for the mess...<div>I made an error because I thought that tiffs were RGB black and white but they are sigle band 1 bit images</div><div><br></div><div>I tried to use nodata values during vrt generation like this</div>

<div><pre style="font-family:monospace,fixed;font-size:9pt;border:1px solid rgb(196,207,229);background-color:rgb(251,252,253);padding:4px 6px;margin:4px 8px 4px 2px;overflow:auto;word-wrap:break-word;line-height:15px">gdalbuildvrt -hidenodata -vrtnodata "0" test.vrt *.tif</pre>
</div><div><br></div><div>Then mosaic tiffs with</div><div>gdal_translate -of Gtiff -co SPARSE_OK=TRUE -a_nodata 0 -co NBITS=1 -co "TILED=YES" -co "COMPRESS=CCITTFAX4" -co "INTERLEAVE=BAND" -co "TFW=YES" "test.vrt" "test.tif"</div>

<div><br></div><div>Null overlapping areas still present in the output..</div><div><br></div><div>Where is my mistake?</div><div><br></div><div>Here is the gdalinfo for a tiff</div><div>*********************************************</div>

<div><div>Driver: GTiff/GeoTIFF</div><div>Files: 018131.tif</div><div>       018131.tfw</div><div>       018131.aux</div><div>Size is 7400, 6491</div><div>Coordinate System is `'</div><div>Origin = (2344486.561459757400000,5168752.558307543400000)</div>

<div>Pixel Size = (0.442006745841354,-0.442006746307015)</div><div>Metadata:</div><div>  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)</div><div>  TIFFTAG_SOFTWARE=IrfanView</div><div>  TIFFTAG_XRESOLUTION=57</div><div>  TIFFTAG_YRESOLUTION=57</div>

<div>Image Structure Metadata:</div><div>  COMPRESSION=CCITTFAX4</div><div>  INTERLEAVE=BAND</div><div>  MINISWHITE=YES</div><div>Corner Coordinates:</div><div>Upper Left  <a href="tel:%28%202344486.561" value="+12344486561" target="_blank">( 2344486.561</a>, <a href="tel:5168752.558" value="+15168752558" target="_blank">5168752.558</a>) </div>
<div>Lower Left  <a href="tel:%28%202344486.561" value="+12344486561" target="_blank">( 2344486.561</a>, <a href="tel:5165883.493" value="+15165883493" target="_blank">5165883.493</a>) </div>
<div>Upper Right <a href="tel:%28%202347757.411" value="+12347757411" target="_blank">( 2347757.411</a>, <a href="tel:5168752.558" value="+15168752558" target="_blank">5168752.558</a>) </div><div>Lower Right <a href="tel:%28%202347757.411" value="+12347757411" target="_blank">( 2347757.411</a>, <a href="tel:5165883.493" value="+15165883493" target="_blank">5165883.493</a>) </div>
<div>Center      <a href="tel:%28%202346121.986" value="+12346121986" target="_blank">( 2346121.986</a>, <a href="tel:5167318.025" value="+15167318025" target="_blank">5167318.025</a>) </div><div>Band 1 Block=7400x1 Type=Byte, ColorInterp=Palette</div>
<div>  Description = Band_1</div>
<div>  Metadata:</div><div>    LAYER_TYPE=athematic</div><div>  Image Structure Metadata:</div><div>    NBITS=1</div><div>  Color Table (RGB with 2 entries)</div><div>    0: 255,255,255,255</div><div>    1: 0,0,0,255</div>

</div><div>*********************************************</div><div> <br><br><div class="gmail_quote">2012/11/14 Pietro Rossin <span dir="ltr"><<a href="mailto:pierigis@gmail.com" target="_blank">pierigis@gmail.com</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><div>Ok<div>I made a test VRT and I applied your gdal_translate command.</div><div>It work and the result is a tiff with a weight of about the sum of the two test mosaiced tiffs.</div>

<div>But as you can see in this image</div>
<div><br></div><div><a href="http://www.flickr.com/photos/90029615@N05/8184720800/" rel="nofollow" link="external" target="_blank">http://www.flickr.com/photos/90029615@N05/8184720800/</a><br><br>the two tiffs have a white orizzontal stripe that separate them.</div>

<div>
This is because each tif to be mosaiced have a white frame and every frame overlap to "data" areas of adiacent images.</div><div><br></div><div>If I eliminate the 255 value from original tiffs the result is like this</div>


<div><a href="http://www.flickr.com/photos/90029615@N05/8184744636/" rel="nofollow" link="external" target="_blank">http://www.flickr.com/photos/90029615@N05/8184744636/</a></div><div><br></div><div>I tried using -a_nodata 255 in gdal_translate command but the result is the same white separation..</div>


<div><br></div><div>How can I set 255 values to nodata before mosaic each tiff?</div><div><br></div><div>Thank you very much for your help!</div><div>Pietro</div><div><br></div></div></div><div><br><div class="gmail_quote">
2012/11/13 MORREALE Jean Roc [via OSGeo.org] <span dir="ltr"><<a href="http://user/SendEmail.jtp?type=node&node=5016218&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>></span><div><div class="h5">
<br>

<blockquote style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote"><div><div><div>

        Hi,
<br><br>You could start by merging all your tiff in a VRT then do 
<br>gdal_translate -of Gtiff -co SPARSE_OK=TRUE -a_nodata 0 -co NBITS=1 -co 
<br>"TILED=YES" -co "COMPRESS=CCITTFAX4" -co "INTERLEAVE=BAND" "example.vrt" 
<br>"example.tif"
<br><br>Le 2012-11-13 17:14, Pietro Rossin a écrit :
</div><div><br><div>> Hello all
<div><br>> I have ~1000 tiff/tfw RGB but with only 0 or 255 color value in all 
<br>> bands
<br>> (black/white).
<br>> I want to mosaic them in a single image to be used in qgis and other 
<br>> gis
<br>> software.
<br>>
<br>> Which is the best way to do this? And to compress the resulting 
<br>> image? May
<br>> be Tiff?? Single band??
<br>> Another problem is that I must apply a formula to input images to 
<br>> transform
<br>> 255 value to null, because of some white portion of each image that 
<br>> overlap
<br>> to black portion of the adiacent one..
<br>>
<br>> Thanks
<br>> Pietro
</div></div></div><div>Le 2012-11-13 17:14, Pietro Rossin a écrit :
</div><div><br><div>> Hello all
<div><br>> I have ~1000 tiff/tfw RGB but with only 0 or 255 color value in all 
<br>> bands
<br>> (black/white).
<br>> I want to mosaic them in a single image to be used in qgis and other 
<br>> gis
<br>> software.
<br>>
<br>> Which is the best way to do this? And to compress the resulting 
<br>> image? May
<br>> be Tiff?? Single band??
<br>> Another problem is that I must apply a formula to input images to 
<br>> transform
<br>> 255 value to null, because of some white portion of each image that 
<br>> overlap
<br>> to black portion of the adiacent one..
<br>>
<br>> Thanks
<br>> Pietro
</div></div>_______________________________________________
</div>gdal-dev mailing list
<br></div></div><div><a href="http://user/SendEmail.jtp?type=node&node=5016032&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="nofollow" link="external" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a>

        
        
        
        <br>
        <br>
        <hr noshade size="1" color="#cccccc">
        <div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                <a href="http://osgeo-org.1560.n6.nabble.com/Best-way-to-mosaic-and-compress-lots-of-tiff-Black-white-tp5016021p5016032.html" rel="nofollow" link="external" target="_blank">http://osgeo-org.1560.n6.nabble.com/Best-way-to-mosaic-and-compress-lots-of-tiff-Black-white-tp5016021p5016032.html</a>
        </div>
        <div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                
                To unsubscribe from Best way to mosaic and compress lots of tiff Black/white?, <a rel="nofollow" link="external">click here</a>.<br>

                <a href="http://osgeo-org.1560.n6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" link="external" target="_blank">NAML</a>
        </div></div></blockquote></div></div></div><br></div>


        
        
        
<br><hr align="left" width="300">
View this message in context: <a href="http://osgeo-org.1560.n6.nabble.com/Best-way-to-mosaic-and-compress-lots-of-tiff-Black-white-tp5016021p5016218.html" target="_blank">Re: Best way to mosaic and compress lots of tiff Black/white?</a><div class="im">
<div>
<div><br>
Sent from the <a href="http://osgeo-org.1560.n6.nabble.com/GDAL-Dev-f3742093.html" target="_blank">GDAL - Dev mailing list archive</a> at Nabble.com.<br></div></div><br></div><div class="im">_______________________________________________<br>


gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></div></blockquote></div><br></div>
</blockquote></div><br></div>