LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > sag47
User Name
Password

Notices


Rate this Entry

Convert and resize images using imagemagick

Posted 05-30-2011 at 10:07 PM by sag47
Updated 05-31-2011 at 01:23 AM by sag47

This past memorial day weekend I took a bunch of pictures which I wanted to post to the web. Web photos are best viewed in 800x600px and I had a lot of them. So I used a simple command to do it.
Code:
for x in `ls -1`;do convert -resize 800x600 $x `echo $x | sed 's/.JPG/.png/'`;done
mkdir web_album
for x in `ls -1 *.png`;do convert $x web_album/`echo $x | sed 's/.png/.jpg/'`;done
rm *.png
Now I don't have to spend all my time in Gimp with that simple batch command.
Posted in Uncategorized
Views 7806 Comments 1
« Prev     Main     Next »
Total Comments 1

Comments

  1. Old Comment
    Just resized pictures 25% smaller and used a better way to change extensions which I outlined in this thread.

    Code:
    for x in *.JPG;do convert -resize 25% $x processed/${x%.JPG}.jpg;done
    ${x%.JPG} takes .JPG off of the end of the variable $x which allows me to rename all the pictures from .JPG to .jpg extension with the following variable "${x%.JPG}.jpg"
    Posted 03-03-2012 at 05:28 PM by sag47 sag47 is offline
    Updated 03-03-2012 at 05:32 PM by sag47
 

  



All times are GMT -5. The time now is 01:38 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration