You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
# 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
|
|
|
|
|
|
|
|
|
|
# Make text annotatation (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
|
|
|
|
|
|