On Apr 2, 2014, at 3:54 AM, Chaitanya kumar CH <[email protected]> wrote:

> William,
> 
> Try gdalwarp after removing the mask band.

Removing the mask band is what I want, but also keeping the nodata values AND 
changing them to 255.  If I remove the mask nodata is set to 0, but there may 
be actual black pixels in the real data that will then become nodata when 
restoring and changing nodata values.  I could take more time in PS and change 
all black to 1,1,1.  I'm already changing white to 254.254,254 so it doesn't 
become nodata at some point (though it doesn't matter so much because it will 
become white in the end anyways).

So far, I have a messy, but working, process:

PS to clear collar - alpha mask
QGIS rectify - copy GDAL commands, alter them to create a tfw, and run manually
PS to flatten rectified tiff so nodata = white (PS destroys georeferencing, but 
it's safe in tfw)
gdal_translate to assign nodata and projection (needed anyways because QGIS 
rectifier doesn't assign projection, it's broken)
merge into vrt

> If that didn't work try gdal_merge.py with -init set to 255.
> 
My experience with gdal_merge.py in the past is either it's slower than making 
a vrt and translating that to geotiff, and it has memory problems with many 
and/or large rasters because it assembles the raster in memory.

> 
> On Wed, Apr 2, 2014 at 1:44 AM, William Kyngesburye <[email protected]> 
> wrote:
> I've wrestled with various nodata issues in the past, now it's hitting me 
> again...
> 
> I'm using Photoshop to delete collars on scanned maps, creating an alpha 
> mask.  GDAL has no problem with this.  What I want to do is merge maps 
> together (after rectification), then set any remaining nodata areas to white, 
> RGB 255,255,255.  Just dropping the extra alpha band doesn't work because 
> nodata is set to 0,0,0, which is black.  The a_nodata option in 
> gdal_translate just defines what existing value in the data is nodata.
> 
> I tried using gdalwarp with the -dstnodata option which should set nodata 
> values in the output to a specific value, but it carries along the alpha band 
> and ignores dstnodata.
> 
>   gdalwarp -dstnodata "255 255 255" in.tif out.tif
>   Processing input file in.tif.
>   Using band 4 of source image as alpha.
>   Using band 4 of destination image as alpha.
> 
> 

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

All generalizations are dangerous, even this one.


_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to