[gdal-dev] Problem with black edges to DOQQs using JPEG in Tiff compression

Stephen Woodbridge woodbri at swoodbridge.com
Sat Feb 11 15:18:35 PST 2017

Hi All,

I need your wisdom. I'm downloading NAIP DOQQs in GTiff format and I 
have a processing chain something like the following:

gdalwarp -t_srs EPSG:4326 -dstalpha -r "bilinear -multi -co TILED=YES 
-dstnodata '0 0 0' srctiff tmpfile

nearblack -nb 15 -q tmpfile

gdal_translate -co TILED=YES -co JPEG_QUALITY=90 -co COMPRESS=JPEG -co 
PHOTOMETRIC=YCBCR -b 1 -b 2 -b 3 -mask auto --config 

nearblack -nb 5 -q target

gdaladdo -clean -r bilinear  target 2 4 8 16 32 64 128 512

And create a tileindex for mapserver of all the tiffs

If I skip the gdal_translate (ie: JPEG compression) and the 2nd 
nearblack, the doqq tiles are perfect with no nearblack edges between 
the doqq tiles. But when a JPEG compress them, I get edges between the 
doqqs like this:


I've never used the JPEG in tiff compression and I'm very impressed by 
the amount of size reduction there and how good the image remains, but I 
have not been able to figure out the magic trick to clearing the edge 

Any help would be appreciated.


This email has been checked for viruses by Avast antivirus software.

More information about the gdal-dev mailing list