update imagemagick commands

This commit is contained in:
Malin Freeborn 2025-01-16 21:52:54 +01:00
parent 5e07604f4b
commit e534d24e52
Signed by: andonome
GPG Key ID: 52295D2377F4D70F

View File

@ -6,35 +6,35 @@ tags: [ "Documentation", "Vision" ]
Convert jpg to png. Convert jpg to png.
```bash ```bash
convert image.jpg image.png magick image.jpg image.png
``` ```
```bash ```bash
convert image.jpg -quality 50 image.jpg magick image.jpg -quality 50 image.jpg
``` ```
'Quality' must be from 1 to 100. 'Quality' must be from 1 to 100.
```bash ```bash
convert -resize 50% image.jpg image2.jpg magick -resize 50% image.jpg image2.jpg
``` ```
Resizing only changes jpegs. Change a png with: Resizing only changes jpegs. Change a png with:
```bash ```bash
convert input.png png8:out.png magick input.png png8:out.png
``` ```
# Invert Colours # Invert Colours
```bash ```bash
convert input.jpg output.jpg -negate magick input.jpg output.jpg -negate
``` ```
# Make Images Smaller # Make Images Smaller
```bash ```bash
convert image.jpg -resize 25% output.jpg magick image.jpg -resize 25% output.jpg
``` ```
@ -43,13 +43,13 @@ convert image.jpg -resize 25% output.jpg
This is generally used for transparent images. This is generally used for transparent images.
```bash ```bash
convert -trim image.png output.png magick -trim image.png output.png
``` ```
Make the white of an image transparent. Make the white of an image transparent.
```bash ```bash
convert -transparent white -fuzz 10% input.png output.png magick -transparent white -fuzz 10% input.png output.png
``` ```
The 'fuzz' option tells the computer that 'close to white' is fine. You might want to use 20% or higher fuzz. The 'fuzz' option tells the computer that 'close to white' is fine. You might want to use 20% or higher fuzz.
@ -58,7 +58,7 @@ The 'fuzz' option tells the computer that 'close to white' is fine. You might w
## Dropshadow ## Dropshadow
```bash ```bash
`convert <input file> \( +clone -background black -shadow 50x8+0+5 \) +swap -background none -layers merge +repage <output file>` `magick <input file> \( +clone -background black -shadow 50x8+0+5 \) +swap -background none -layers merge +repage <output file>`
``` ```
@ -70,13 +70,13 @@ mogrify -format png *.jpg
# Printing Words # Printing Words
# Mass convert # Mass magick
This script converts all jpg files in a directory to svg. This script magicks all jpg files in a directory to svg.
``` ```
for i in *jpg for i in *jpg
do convert "$i" $(ls "$i" | sed s#jpg\$#svg#) do magick "$i" $(ls "$i" | sed s#jpg\$#svg#)
done done
``` ```
@ -86,7 +86,7 @@ The above script has crappy results.
It's better to use potrace. It's better to use potrace.
``` ```
$convert -flatten input.jpg output.ppm $magick -flatten input.jpg output.ppm
$potrace -s output.ppm -o svgout.svg $potrace -s output.ppm -o svgout.svg
``` ```
@ -97,19 +97,19 @@ $potrace -s output.ppm -o svgout.svg
See your installed fonts: See your installed fonts:
```bash ```bash
convert -list font magick -list font
``` ```
Make an image showing day of the week: Make an image showing day of the week:
```bash ```bash
convert -fill blue -font Sauce-Code-Pro-Semibold-Nerd-Font-Complete-Mono -gravity center -pointsize 79 label:$(date +%A) day.png magick -fill blue -font Sauce-Code-Pro-Semibold-Nerd-Font-Complete-Mono -gravity center -pointsize 79 label:$(date +%A) day.png
``` ```
Make a meme: Make a meme:
```bash ```bash
convert inputmemeimage.png -font impact -fill white -pointsize 84 -stroke black -strokewidth 3 -gravity north -annotate +0+20 'TOP MEME TEXT' -gravity south -annotate +0+20 'BOTTOM MEME TEXT' outputmemeimage.png magick inputmemeimage.png -font impact -fill white -pointsize 84 -stroke black -strokewidth 3 -gravity north -annotate +0+20 'TOP MEME TEXT' -gravity south -annotate +0+20 'BOTTOM MEME TEXT' outputmemeimage.png
``` ```