Page 2 of 2
Re: How to erase shoreline but preserve admin land borders?
Posted: 2017-06-23T13:35:56-07:00
by Bonzo
I have just run fmw42's last code above on a Windows 10 PC with a V7.05 Q16 install and get the same results as fmw42.
Still using convert, changing the \ to ^ and removing the \ from the parentheses.
Re: How to erase shoreline but preserve admin land borders?
Posted: 2017-06-23T13:36:05-07:00
by fmw42
With my code, you must use Cygwin or change the code to Windows equivalent syntax. Perhaps your Cygwin version of ImageMagick is too old? Connected Components Labelling requires IM 6.8.9.10 or higher. But some features were added later regarding mean-color=true. The latest changelog for connected components is 6.9.6-8, but I think the following should work earlier than that.
In Windows CMD window (not .bat), try
Code: Select all
convert admin_borders.png ^
( oceanmask.png -blur 0x5 -level 99,100% ) -compose In -composite ^
admin_borders_choked.png
convert admin_borders_choked.png -alpha off -threshold 0 ^
-define connected-components:area-threshold=75 ^
-define connected-components:mean-color=true ^
-connected-components 8 ^
admin_borders_clean.png
convert admin_borders_choked.png -alpha off -threshold 0 ^
-define connected-components:area-threshold=75 ^
-define connected-components:mean-color=true ^
-connected-components 8 -transparent black ^
admin_borders_clean_trans.png
Re: How to erase shoreline but preserve admin land borders?
Posted: 2017-06-23T13:41:03-07:00
by yarr
I reinstalled my Windows IM.
Both commands work:
Code: Select all
convert admin_borders.png ^
( oceanmask.png -blur 0x5 -level 99,100%% ) -compose In -composite ^
admin_borders_choked.png
convert admin_borders_choked.png -alpha off -threshold 0 ^
-define connected-components:area-threshold=75 ^
-define connected-components:mean-color=true ^
-connected-components 8 ^
admin_borders_clean.png
convert admin_borders_choked.png -alpha off -threshold 0 ^
-define connected-components:area-threshold=75 ^
-define connected-components:mean-color=true ^
-connected-components 8 -transparent black ^
admin_borders_clean_trans.png
Thank you.
yarr
Re: How to erase shoreline but preserve admin land borders?
Posted: 2017-06-24T01:16:28-07:00
by yarr
After upgrading
IM I noticed meaningful difference in my other composites rendered previously as I expected.
ImageMagick 6.9.2-0 Q16 x64 2015-08-15
ImageMagick 7.0.6-0 Q16 x64 2017-06-11
Can you please
help me find the reason of this difference and correct the syntax?
Code: Select all
convert -quiet ^
( ^
( ^
blueyahoo.tif ( bumpmap.tif -blur 0x1 ) ^
-level 5%%,100,3 -modulate 100,120,102 -compose bumpmap -composite ^
landwater.png -compose Over -composite ^
) ^
oceanmask.png -mask oceanmask.png -compose Copy -composite ^
) ^
bathy.tif -mask oceanmask.png -compose Over -composite ^
-compress lzw ^
blueyahoo_composite.tif
Re: How to erase shoreline but preserve admin land borders?
Posted: 2017-06-24T01:44:14-07:00
by yarr
All right, I found the solution: removing unnecessary line
Code: Select all
oceanmask.png -mask oceanmask.png -compose Copy -composite ^
But please tell me if the code could be smarter.
Re: How to erase shoreline but preserve admin land borders?
Posted: 2017-06-24T10:37:54-07:00
by fmw42
In IM 7, use "magick" not "convert" (without the quotes)
Re: How to erase shoreline but preserve admin land borders?
Posted: 2017-06-30T13:18:22-07:00
by fmw42
In IM 7 Windows CMD window, this should work.
Code: Select all
magick admin_borders.png ^
( oceanmask.png -blur 0x5 -level 99,100% ) -compose In -composite ^
admin_borders_choked.png
magick admin_borders_choked.png -alpha off -threshold 0 ^
-define connected-components:area-threshold=75 ^
-define connected-components:mean-color=true ^
-connected-components 8 ^
admin_borders_clean.png
magick admin_borders_choked.png -alpha off -threshold 0 ^
-define connected-components:area-threshold=75 ^
-define connected-components:mean-color=true ^
-connected-components 8 -transparent black ^
admin_borders_clean_trans.png