Skip to content

Commit

Permalink
Uniformize swamp rendering with forest/wood (#3051)
Browse files Browse the repository at this point in the history
* Uniformize swamp rendering with forest/wood (fixes #1920)

Thanks @imagico for the pattern

* Updated swamp.svg and regenerated patterns accordingly

* Ajout pour mémoire des commandes utilisées pour génération

* Finally generated a correct PNG pattern for swamps

* Pixel-aligned and corrected gamma of swamp pattern
  • Loading branch information
Penegal authored and imagico committed Mar 6, 2019
1 parent 488fd2c commit 57d2fe3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
6 changes: 3 additions & 3 deletions symbols/generating_patterns/swamp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions symbols/generating_patterns/wetland.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,23 @@ convert -depth 8 -size 512x512 xc:"$SYMBOL" \( pattern.png -negate \) -set color
convert -depth 8 -size 512x512 xc:"$WETLAND" \( wetland_pattern_bkg.png -negate \) -set colorspace RGB -alpha Off -compose CopyOpacity -composite +compose pattern_col.png -compose Over -composite wetland_pattern.png
```

In some cases, which has not been elucidated (https://github.com/gravitystorm/openstreetmap-carto/pull/3051), the SVG conversions produce files with erroneous sizes. In this case, the following command sequence may work, by using Inkscape to rasterize the SVGs:

```
inkscape -z --export-png=swamp.png --export-dpi=96 --export-background=white swamp.svg
inkscape -z --export-png=swamp_hr.png --export-dpi=768 --export-background=white swamp.svg
convert swamp_hr.png -morphology Erode Disk:5.3 \( +clone -fill black -draw 'color 0,0 floodfill' -negate \) +swap -morphology Erode Disk:10.3 -compose Darken -composite -scale 12.5% -depth 8 pattern_casing.png
inkscape -z --export-png=wetland_tile.png --export-dpi=96 --export-background=white wetland.svg
montage wetland_tile.png wetland_tile.png wetland_tile.png wetland_tile.png -geometry 256x256+0+0 wetland_512.png
convert wetland_512.png \( pattern_casing.png -negate \) -compose Lighten -composite -threshold 50% \( +clone -negate -morphology hitandmiss peaks:1.9 \) -compose Lighten -composite +level 20%,100% wetland_pattern_bkg.png
convert -depth 8 -size 512x512 xc:"#93b685" \( swamp.png -negate \) -set colorspace RGB -alpha Off -compose CopyOpacity -composite pattern_col.png
convert -depth 8 -size 512x512 xc:"#4aa5fa" \( wetland_pattern_bkg.png -negate \) -set colorspace RGB -alpha Off -compose CopyOpacity -composite +compose pattern_col.png -compose Over -composite +gamma - -strip wetland_pattern.png
```
Binary file modified symbols/generating_patterns/wetland_swamp@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified symbols/wetland_swamp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 57d2fe3

Please sign in to comment.