CONVERT Commands Cheat Sheet

Here is a cli commands cheat sheet for CONVERT command, you can use this as a quick reminder for basic commands with a brief description for each of the commands.

What is CONVERT command?

Add some data here

        # To convert a file from jpg to pdf
convert original.jpg converted.pdf

# 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:
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

# To convert an N page pdf to N images (will autonumber):
convert -density 150 arch1.pdf -quality 80 'output.jpg'

# To convert an N page pdf to N images with explicit filename formatting:
convert -density 150 arch1.pdf -quality 80 'output-%d.jpg'
    

Check out the CONVERT command documentation .


You can also check our MegaSh cheatsheet tool, that has 150+ searchable linux cheat sheets in one page, so you never forget a command as you work again

Check Also

Best AI tools list