2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-17 09:25:32 +00:00
cheat.sheets/sheets/convert
terminalforlife 69bbce3d28 Add vignette and grayscale example
I mostly use this sort of thing to create backgrounds which seem to go
nicely with my terminal theme and layout. Works well on nature images.
2019-11-06 14:47:22 +00:00

35 lines
1.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Resize an image to a fixed width and proportional height:
convert original-image.jpg -resize 100x converted-image.jpg
# Resize an image to a fixed height and proportional width:
convert original-image.jpg -resize x100 converted-image.jpg
# Resize an image to a fixed width and height:
convert original-image.jpg -resize 100x100 converted-image.jpg
# Resize an image and simultaneously change its file type:
convert original-image.jpg -resize 100x converted-image.png
# Resize all of the images within a directory, using a for loop:
for file in original/image/path/*; do
convert "$file" -resize 150 converted/image/path/"$file"
done
# Make text annotation (text = Flower)
convert flower.jpg -font courier -fill white -pointsize 20 -annotate +50+50 'Flower' flower_annotate1.jpg
# Crop an image
convert flower.jpg -crop 128×128+50+50 flower_crop.jpg
# Rotate an image
convert flower.jpg -rotate 45 flower_rotate45.jpg
# Add a border
convert -border 1x1 -bordercolor "#FFFFFF" image.png new-image.png
# Convert PNG to JPEG (with 70% quality)
convert -quality 70 image.png new_image.jpg
# Apply vignette and grayscale effects to all JPGs in the CWD, using a for loop.
for FILE in *.jpg; { convert -background black -colorspace gray -vignette 200x100 "$FILE" "$FILE"; }