aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/cheat/convert
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-09-05 07:05:07 +0200
committerneodarz <neodarz@neodarz.net>2019-09-05 07:05:07 +0200
commite0c0d4b38cde20e2300e86b69414dd9851b47456 (patch)
tree5df65243447352a9637d1f783247bfd5ccff2ef4 /dotfiles/cheat/convert
parentdc45bf89a66ec6c8cd25cf5605deb853f6984705 (diff)
downloaddotfiles_dotdrop-e0c0d4b38cde20e2300e86b69414dd9851b47456.tar.xz
dotfiles_dotdrop-e0c0d4b38cde20e2300e86b69414dd9851b47456.zip
ooo
Diffstat (limited to 'dotfiles/cheat/convert')
-rw-r--r--dotfiles/cheat/convert22
1 files changed, 22 insertions, 0 deletions
diff --git a/dotfiles/cheat/convert b/dotfiles/cheat/convert
new file mode 100644
index 0000000..6e99e5b
--- /dev/null
+++ b/dotfiles/cheat/convert
@@ -0,0 +1,22 @@
+# To resize an image to a fixed width and proportional height:
+convert original-image.jpg -resize 100x converted-image.jpg
+
+# To resize an image to a fixed height and proportional width:
+convert original-image.jpg -resize x100 converted-image.jpg
+
+# To resize an image to a fixed width and height:
+convert original-image.jpg -resize 100x100 converted-image.jpg
+
+# To resize an image and simultaneously change its file type:
+convert original-image.jpg -resize 100x converted-image.png
+
+# To resize all of the images within a directory:
+# To implement a for loop:
+for file in `ls original/image/path/`;
+ do new_path=${file%.*};
+ new_file=`basename $new_path`;
+ convert $file -resize 150 conerted/image/path/$new_file.png;
+done
+
+# Resize multi-image and blur it from <filename>.jpg to <filename>_tiny.jpg:
+for file in $(ls .); do convert $(echo "$(echo $file | cut -f 1 -d '.').jpg") -resize 5% -blur 0x8 $(echo "$(echo $file | cut -f 1 -d '.')_tiny.jpg") ; done