[gdal-dev] Best way to mosaic and compress lots of tiff Black/white?

Pietro Rossin pierigis at gmail.com
Wed Nov 14 05:11:22 PST 2012


Sorry for the mess...
I made an error because I thought that tiffs were RGB black and white but
they are sigle band 1 bit images

I tried to use nodata values during vrt generation like this

gdalbuildvrt -hidenodata -vrtnodata "0" test.vrt *.tif


Then mosaic tiffs with
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"

Null overlapping areas still present in the output..

Where is my mistake?

Here is the gdalinfo for a tiff
*********************************************
Driver: GTiff/GeoTIFF
Files: 018131.tif
       018131.tfw
       018131.aux
Size is 7400, 6491
Coordinate System is `'
Origin = (2344486.561459757400000,5168752.558307543400000)
Pixel Size = (0.442006745841354,-0.442006746307015)
Metadata:
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
  TIFFTAG_SOFTWARE=IrfanView
  TIFFTAG_XRESOLUTION=57
  TIFFTAG_YRESOLUTION=57
Image Structure Metadata:
  COMPRESSION=CCITTFAX4
  INTERLEAVE=BAND
  MINISWHITE=YES
Corner Coordinates:
Upper Left  ( 2344486.561, 5168752.558)
Lower Left  ( 2344486.561, 5165883.493)
Upper Right ( 2347757.411, 5168752.558)
Lower Right ( 2347757.411, 5165883.493)
Center      ( 2346121.986, 5167318.025)
Band 1 Block=7400x1 Type=Byte, ColorInterp=Palette
  Description = Band_1
  Metadata:
    LAYER_TYPE=athematic
  Image Structure Metadata:
    NBITS=1
  Color Table (RGB with 2 entries)
    0: 255,255,255,255
    1: 0,0,0,255
*********************************************


2012/11/14 Pietro Rossin <pierigis at gmail.com>

> Ok
> I made a test VRT and I applied your gdal_translate command.
> It work and the result is a tiff with a weight of about the sum of the two
> test mosaiced tiffs.
> But as you can see in this image
>
> http://www.flickr.com/photos/90029615@N05/8184720800/
>
> the two tiffs have a white orizzontal stripe that separate them.
> This is because each tif to be mosaiced have a white frame and every frame
> overlap to "data" areas of adiacent images.
>
> If I eliminate the 255 value from original tiffs the result is like this
> http://www.flickr.com/photos/90029615@N05/8184744636/
>
> I tried using -a_nodata 255 in gdal_translate command but the result is
> the same white separation..
>
> How can I set 255 values to nodata before mosaic each tiff?
>
> Thank you very much for your help!
> Pietro
>
>
> 2012/11/13 MORREALE Jean Roc [via OSGeo.org] <[hidden email]<http://user/SendEmail.jtp?type=node&node=5016218&i=0>
> >
>
>> Hi,
>>
>> You could start by merging all your tiff in a VRT then do
>> gdal_translate -of Gtiff -co SPARSE_OK=TRUE -a_nodata 0 -co NBITS=1 -co
>> "TILED=YES" -co "COMPRESS=CCITTFAX4" -co "INTERLEAVE=BAND" "example.vrt"
>> "example.tif"
>>
>> Le 2012-11-13 17:14, Pietro Rossin a écrit :
>>
>> > Hello all
>>
>> > I have ~1000 tiff/tfw RGB but with only 0 or 255 color value in all
>> > bands
>> > (black/white).
>> > I want to mosaic them in a single image to be used in qgis and other
>> > gis
>> > software.
>> >
>> > Which is the best way to do this? And to compress the resulting
>> > image? May
>> > be Tiff?? Single band??
>> > Another problem is that I must apply a formula to input images to
>> > transform
>> > 255 value to null, because of some white portion of each image that
>> > overlap
>> > to black portion of the adiacent one..
>> >
>> > Thanks
>> > Pietro
>> Le 2012-11-13 17:14, Pietro Rossin a écrit :
>>
>> > Hello all
>>
>> > I have ~1000 tiff/tfw RGB but with only 0 or 255 color value in all
>> > bands
>> > (black/white).
>> > I want to mosaic them in a single image to be used in qgis and other
>> > gis
>> > software.
>> >
>> > Which is the best way to do this? And to compress the resulting
>> > image? May
>> > be Tiff?? Single band??
>> > Another problem is that I must apply a formula to input images to
>> > transform
>> > 255 value to null, because of some white portion of each image that
>> > overlap
>> > to black portion of the adiacent one..
>> >
>> > Thanks
>> > Pietro
>> _______________________________________________
>> gdal-dev mailing list
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=5016032&i=0>
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://osgeo-org.1560.n6.nabble.com/Best-way-to-mosaic-and-compress-lots-of-tiff-Black-white-tp5016021p5016032.html
>>  To unsubscribe from Best way to mosaic and compress lots of tiff
>> Black/white?, click here.
>> NAML<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>
>>
>
>
> ------------------------------
> View this message in context: Re: Best way to mosaic and compress lots of
> tiff Black/white?<http://osgeo-org.1560.n6.nabble.com/Best-way-to-mosaic-and-compress-lots-of-tiff-Black-white-tp5016021p5016218.html>
>
> Sent from the GDAL - Dev mailing list archive<http://osgeo-org.1560.n6.nabble.com/GDAL-Dev-f3742093.html>at Nabble.com.
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20121114/c8a12711/attachment-0001.html>


More information about the gdal-dev mailing list