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.
How to erase shoreline but preserve admin land borders?
Re: How to erase shoreline but preserve admin land borders?
Last edited by Bonzo on 2017-06-23T13:36:11-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to erase shoreline but preserve admin land borders?
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
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?
I reinstalled my Windows IM.
Both commands work:
Thank you.
yarr
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
yarr
yarr
ImageMagick 7.0.6-0 Q16 x64 2017-06-11
Windows 7 Professional 64 bit, i7-4790 CPU 3.60 GHz, RAM 32 GB
Cartographic environment: Perl, GDAL, Global Mapper
ImageMagick 7.0.6-0 Q16 x64 2017-06-11
Windows 7 Professional 64 bit, i7-4790 CPU 3.60 GHz, RAM 32 GB
Cartographic environment: Perl, GDAL, Global Mapper
Re: How to erase shoreline but preserve admin land borders?
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?
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
yarr
ImageMagick 7.0.6-0 Q16 x64 2017-06-11
Windows 7 Professional 64 bit, i7-4790 CPU 3.60 GHz, RAM 32 GB
Cartographic environment: Perl, GDAL, Global Mapper
ImageMagick 7.0.6-0 Q16 x64 2017-06-11
Windows 7 Professional 64 bit, i7-4790 CPU 3.60 GHz, RAM 32 GB
Cartographic environment: Perl, GDAL, Global Mapper
Re: How to erase shoreline but preserve admin land borders?
All right, I found the solution: removing unnecessary line
But please tell me if the code could be smarter.
Code: Select all
oceanmask.png -mask oceanmask.png -compose Copy -composite ^
yarr
ImageMagick 7.0.6-0 Q16 x64 2017-06-11
Windows 7 Professional 64 bit, i7-4790 CPU 3.60 GHz, RAM 32 GB
Cartographic environment: Perl, GDAL, Global Mapper
ImageMagick 7.0.6-0 Q16 x64 2017-06-11
Windows 7 Professional 64 bit, i7-4790 CPU 3.60 GHz, RAM 32 GB
Cartographic environment: Perl, GDAL, Global Mapper
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to erase shoreline but preserve admin land borders?
In IM 7, use "magick" not "convert" (without the quotes)
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to erase shoreline but preserve admin land borders?
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