Solved

Resize photos in a directory

Posted on 2009-06-28
2
368 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
winscp 000webhost.com 6 97
UM7 Stop Sending packets with GPS Sensor 1 18
How to swap or extend CentOS partition 11 27
regular expression help for sed command 5 39
This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 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