Page 1 of 1
Making 1 px wide routeline wider
Posted: 2015-01-15T01:23:09-07:00
by zwak
I have GPS route drawn on raster map with red color (nothing else is exactly #ff0000 red in image).
I would like to find out how to make each pixel neighbouring red pixel also red. Or any other way to make this route more visible.
Small example picture:
Thanks for any hints.
Re: Making 1 px wide routeline wider
Posted: 2015-01-15T05:30:02-07:00
by snibgo
I have renamed your input map as "mapRedPath.png".
The following Windows BAT command make a copy. For that copy, it turns red into white and everything else black. It thickens the white line. Then it makes black transparent, and turns white into red. The result is composited over the map.
Code: Select all
convert ^
mapRedPath.png ^
( +clone ^
-fill Black +opaque Red ^
-fill White -opaque Red ^
-morphology dilate disk:1 ^
-transparent black ^
-fill Red -opaque White ^
) ^
-compose Over -composite ^
m.png
This works with any colour of path. As "red" uses a single channel, it could probably be optimised.
Re: Making 1 px wide routeline wider
Posted: 2015-01-15T12:10:57-07:00
by zwak
Thanks! This works brilliantly.
Morphology seems to contain many interesting tools for neighborhood which I was unable to find myself.