-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert
45 lines (32 loc) · 1.27 KB
/
convert
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# imagemagick utility
# To resize an image to a fixed width and proportional height:
convert original.jpg -resize 100x converted.jpg
# To resize an image to a fixed height and proportional width:
convert original.jpg -resize x100 converted.jpg
# To resize an image to a fixed width and height:
convert original.jpg -resize 100x100 converted.jpg
# To resize an image and simultaneously change its file type:
convert original.jpg -resize 100x converted.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 converted/image/path/$new_file.png;
done
# convert pdf to image
convert -density 150 filename.pdf -quality 90 output-%03d.jpg
# convert multiple images to single pdf
convert "*.jpg" -quality 85 outfile.pdf
# rotate image by 90 degrees
convert input.jpg -rotate 90 output.jpg
# force dimensions without respect to aspect ratio
-resize 64x64\!
# make gif from images
convert -delay 3 *.png giffile
# remove transparency layer if present from pdf or images
-alpha remove
# join two images side by side
convert img1 img2 +append result.jpg
# convert images to gif using image magick
convert -delay 20 -loop 0 *.jpg myimage.gif