936 B
936 B
| title | seo_description | date | draft | snippet_types | |
|---|---|---|---|---|---|
| imagemagik .png to .jpg with white background | snippet explaining how to use imagemagik to covert images from .png .jpg and make the transparent parts white | 2022-03-03T21:31:00+01:00 | false |
|
Working on some .png map files today. I needed to covert them to small .jpg's for uses in Oblastle. Problem being by default the transparent part fills into to black. Here is how to make it white:
$ ls
us-ak.png
us-al.png
us-ar.png
us-az.png
us-ca.png
$ for file in *.png ; do magick mogrify -format jpg -resize '500' -background white -flatten $file; done
$ ls
us-ak.png
us-ak.jpg
us-al.png
us-al.jpg
us-ar.png
us-ar.jpg
us-az.png
us-az.jpg
us-ca.png
$ rm ./*.png
The important bit being -background white -flatten.