Solved

Resize photos in a directory

Posted on 2009-06-28
2
370 Views
Last Modified: 2013-12-16
I have a Virtual Private server that, through a script, gets a number of photos placed on it.  The script pulls the photos from an email attachment.

Recently, the size of the photos has increased dramatically, from 250k each to over 800K each.  

I would like to know if there is a linux command line that I could use (via cron pref.) to look in the directory and resize all photos over 450k to a lesser quality (10 to 8) or even a smaller size (1050x1500 to 400x1000)??

Thank you.
0
Comment
Question by:TIgerV
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 7

Expert Comment

by:Morne Lategan
ID: 24733791
You can install imagemagick. It has several tools for the job, ranging from resizing to converting between formats. The one you are looking is a tool called mogrify.

http://www.imagemagick.org/script/mogrify.php

0
 
LVL 7

Accepted Solution

by:
Morne Lategan earned 500 total points
ID: 24733824
You'll have to play with the options to find what works best, but in order to get a list of files larger than a specific size, you can use:

find /path/to/images --size 400k --iname \*.jpg

And to run the script agains those:

for imgfile in `find /path/to/images --size 400k --iname \*.jpg`
do
  mogrify --resize 400x1000 $imgfile
done

Sor something like that.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question