John Mitchell wrote:
Hi,

Is their a way to convert just the pure black pixels (0,0,0) around the interior of a tile to 0,0,1?

I believe the solution is to first convert all the pure black pixels(0,0,0) within a tile to 0,0,1 by remapping within gdalwarp

-srcnodata 0,0,0 -dstnodata 0,0,1

and then run nearblack to convert all the 0,0,1 values around the collar back to pure black. That way the interior black values stay at 0,0,1 so later when the tiles are mocaicked via gdalwarp the only pixels that are 0,0,0 are around the collars of the tiles and the void/empty areas that the mosaics creates, which can made invisible within mapserver via offsite 0,0,0.

Does this make sense and if all I want to do is convert the 0,0,1 values to 0,0,0 within near black then should I make the near black parameter (-near 1) instead of the default of value of 15?

John,

This sounds like a reasonable strategy, but you should be aware of a few problems using the current nearblack utility:

1) it only scans the right and left edges of an image and stops when it find N good pixels.

2) it unfortunately does not do a look ahead so it will "eat" N good pixels along the edges. This is not a problem if you have overlap in the edges, otherwise you get gaps between the tiles on the vertical edges.

3) because of 1) if you have data that is U shaped, ie: a strip down the right and left edges and across the bottom, none of the interior of the U will get scanned during near black because it is not efficient to scan pixels vertically.

So if you can live with these, then it should work fine. If not you might look at modifying nearblack to do what you want. I am doing that myself to fix some problems with images I have.

-Steve W

Reply via email to