aboutsummaryrefslogtreecommitdiff
path: root/cheat/.cheat/convert
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-04-26 11:34:19 +0200
committerneodarz <neodarz@neodarz.net>2019-04-26 11:34:19 +0200
commit469e62e70891a37ec4016fcd025f979859074ef7 (patch)
tree690faf01abd10b7d6721d4e46b5dcbfd0727efb3 /cheat/.cheat/convert
parent537e727f43311bc30d93c9af645dde3450605129 (diff)
downloaddotfiles_ascii-469e62e70891a37ec4016fcd025f979859074ef7.tar.xz
dotfiles_ascii-469e62e70891a37ec4016fcd025f979859074ef7.zip
Add moooore cheat
Diffstat (limited to 'cheat/.cheat/convert')
-rw-r--r--cheat/.cheat/convert22
1 files changed, 22 insertions, 0 deletions
diff --git a/cheat/.cheat/convert b/cheat/.cheat/convert
new file mode 100644
index 0000000..6e99e5b
--- /dev/null
+++ b/cheat/.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