Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using gdal to warp images into a different map-projections. However the warping processs seem to leave grey marks where the boundary of the original image was (see warped.png below). I figured out this was probably caused by my image having a white background and the 'filler' pixels created by the warping process being transparent but black. And the interpolation is smudging the black and white together (even though it shouldnt as the black is transparent).

Is there any way to avoid the grey outline from appearing? Maybe force gdalwarp to fill with opaque white rather than transparent black?

I cant do a square crop on the warped image as I'll loose bits of the image, and I cant just make my background black instead of white as this messes up some filtering I have to do beforehand.

Theres seems to be lots of options for gdalwarp that sound useful like -srcnodata but I cant figure out how to use them. Thanks

input.png

warped.png

warped.tiff

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Using the -r near flag will implement nearest-neighbor resampling. If that doesn't get rid of the border, at least it will make it pure black!

share|improve this answer
    
thanks. It turned out that the culprit was not gdalwarp but gdal2tiles (after warping I split the image into google maps tiles, then stitch them together again to check everything looks OK). I used -r near with gdal2tiles and this fixed the problem. –  spiderplant0 Jan 3 '11 at 17:01

You can use the GDAL nearblack tool to make the border white.

share|improve this answer
    
thanks. I'm using whubers solution but if I need improved interpolation I'll try this on the warped TIFF before tiling. –  spiderplant0 Jan 3 '11 at 17:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.