NIGHT_TYPE

Mike Garcia

until your eyes bleed

19. October 2015 204 words ~2 minutes read Comment

ImageMagick Linux Terminal Commands

how-to-geek

Content was copied from How-To-Geek’s Beautiful Article

I’m really just making myself a copy of what they have in case the site goes down or somethin. I always hate having to start up GIMP or some other editor to make minor changes to a folder of images. These always work great and fast.

# How to install
sudo apt-get install imagemagick

# Converting between formats png -> jpg
convert howtogeek.png howtogeek.jpg

# Specify a compression level for JPEG images
convert howtogeek.png -quality 95 howtogeek.jpg

# Resizing Images (aspect ratio reserved by default)
convert example.png -resize 200×100 example.png

# Resizing Images (Fuck the Aspect Ratio!)
convert example.png -resize 200×100! example.png

# Resize an image to a height of 100
convert example.png -resize x100 example.png

# Rotating an Image by 90 degrees
convert howtogeek.jpg -rotate 90 howtogeek-rotated.jpg

# Applying Effects
convert howtogeek.jpg -charcoal 2 howtogeek-charcoal.jpg
convert howtogeek.jpg -implode 1 howtogeek-imploded.jpg

# Combining Operations
convert howtogeek.png -resize 400×400 -rotate 180 -charcoal 4 -quality 95 howtogeek.jpg

####Batch Processing ####
# take all PNG files in the current directory, rotate them, and save a new copy of each
# with “rotated” added to the beginning of each file name
for file in *.png; do convert $file -rotate 90 rotated-$file; done

Leave a Reply