diff options
Diffstat (limited to 'cheat/.cheat/convert')
-rw-r--r-- | cheat/.cheat/convert | 22 |
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 |