add the old snippet md files
This commit is contained in:
parent
fc0dd204c7
commit
bcf8313a4b
110 changed files with 3048 additions and 0 deletions
41
old_snippets/imagemagik-png-to-jpg-white-bg.en.md
Normal file
41
old_snippets/imagemagik-png-to-jpg-white-bg.en.md
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
title: "imagemagik .png to .jpg with white background"
|
||||
seo_description: "snippet explaining how to use imagemagik to covert images from .png .jpg and make the transparent parts white"
|
||||
date: 2022-03-03T21:31:00+01:00
|
||||
draft: false
|
||||
snippet_types:
|
||||
- imagemagik
|
||||
---
|
||||
|
||||
Working on some .png map files today. I needed to covert them to small .jpg's for
|
||||
uses in [Oblastle](https://oblastle.fun). Problem being by default the transparent part
|
||||
fills into to black. Here is how to make it white:
|
||||
|
||||
|
||||
```shell
|
||||
$ 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**.
|
||||
|
||||
[source](https://stackoverflow.com/questions/7943711/change-the-background-of-an-image-in-image-magick)
|
||||
Loading…
Add table
Add a link
Reference in a new issue