Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11th November 2009, 01:48 PM
mikequest Offline
Registered User
 
Join Date: Jun 2009
Posts: 49
linuxfedorafirefox
a batch program that reduces size of jpeg files

Hello,
I'm looking for a program or command line tool that ease the process of reducing size of many .jpeg files at once.
I've been doing this with gimp manually by reducing jpeg quality and it's painful for 10 or 15 files to do that

thanks for replying
Reply With Quote
  #2  
Old 11th November 2009, 02:51 PM
weitjong's Avatar
weitjong Online
Registered User
 
Join Date: Oct 2006
Location: Singapore, 新加坡
Posts: 735
linuxfedorafirefox
Have you tried "imagemagick"? It is swiss army knife of image processing using CLI. Just found this example usage on the web to help you get started. I think you will be interested on example no 3 in http://www.ioncannon.net/linux/72/5-...amples-part-2/
__________________
YaoWT - Leave no window unbroken ^_^
Reply With Quote
  #3  
Old 11th November 2009, 03:26 PM
Gödel's Avatar
Gödel Offline
Registered User
 
Join Date: Jul 2009
Location: London,England
Posts: 1,095
linuxfedorafirefox
Yes, ImageMagick (install via yum) is the way to go

eg, cd to the directory of images, then to resize all by 50% and rename the resized images to <original>_new.jpg do:

Code:
for i in *.jpg; do convert $i -resize 50% "${i%%.*}_new.jpg"; done
Reply With Quote
  #4  
Old 11th November 2009, 04:15 PM
PabloTwo's Avatar
PabloTwo Online
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 5,126
linuxfirefox
You can also use the 'mogrify' command in ImageMagick to do batch processing. Example here does not preserve the original files but overwrites them with the resized files.
Code:
BASH:~/work/test/-> ll
total 1624
-rw-r--r-- 1 paulm root 343047 2009-11-11 11:12 rotten_tree_effects2.jpg
-rw-r--r-- 1 paulm root 649369 2009-11-11 11:12 rotten_tree_effects.jpg
-rw-r--r-- 1 paulm root 642077 2009-11-11 11:12 rotten_tree_stump.jpg
BASH:~/work/test/-> mogrify -resize 50% rotten_tree_*.jpg
BASH:~/work/test/-> ll
total 308
-rw-r--r-- 1 paulm root  53475 2009-11-11 11:13 rotten_tree_effects2.jpg
-rw-r--r-- 1 paulm root  82474 2009-11-11 11:13 rotten_tree_effects.jpg
-rw-r--r-- 1 paulm root 144805 2009-11-11 11:13 rotten_tree_stump.jpg

Last edited by PabloTwo; 11th November 2009 at 04:18 PM.
Reply With Quote
  #5  
Old 11th November 2009, 06:21 PM
mikequest Offline
Registered User
 
Join Date: Jun 2009
Posts: 49
windows_xp_2003opera
thanks a lot guys : )
I'll look at the examples.
fedora rocks : )
Reply With Quote
  #6  
Old 11th November 2009, 06:48 PM
PabloTwo's Avatar
PabloTwo Online
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 5,126
linuxfirefox
Command line use of ImageMagick has a bit of a steep learning curve, only in that the options to the basic commands seem to be almost endless, but once you get the hang of it, it's often way way way faster than messing around in Gimp, especially when batch conversions are involved.

Both Godel and myself used "50%" in our examples to the "-resize" option, but you can also specify an explicit size. For example, to convert all .jpg files in the current directory to 640x480 pixels:
Code:
mogrify -resize 640x480 *.jpg
The identify command from ImageMagick is also handy.

BEFORE
Code:
BASH:~/work/test/-> identify img/rotten_tree_*
rotten_tree_effects2.jpg JPEG 1152x864 1152x864+0+0 DirectClass 8-bit 335.006kb 
rotten_tree_effects.jpg[1] JPEG 1152x864 1152x864+0+0 DirectClass 8-bit 634.148kb 
rotten_tree_stump.jpg[2] JPEG 1152x864 1152x864+0+0 DirectClass 8-bit 627.027kb
AFTER
Code:
BASH:~/work/test/-> identify rotten_tree_*
rotten_tree_effects2.jpg JPEG 640x480 640x480+0+0 DirectClass 8-bit 62.8867kb 
rotten_tree_effects.jpg[1] JPEG 640x480 640x480+0+0 DirectClass 8-bit 104.152kb 
rotten_tree_stump.jpg[2] JPEG 640x480 640x480+0+0 DirectClass 8-bit 173.377kb

Last edited by PabloTwo; 11th November 2009 at 06:50 PM.
Reply With Quote
  #7  
Old 11th November 2009, 08:35 PM
mikequest Offline
Registered User
 
Join Date: Jun 2009
Posts: 49
linuxfedorafirefox
just a precision, I meant by reducing jpeg file size but not the image resolution.
when i do :
"convert image -resize 50% "image_new.jpg" the resolution is cut in half
how to reduce jpeg quality without reducing resolution ? just like I do it in gimp wiht a "save as " jpeg

thanks again
Reply With Quote
  #8  
Old 11th November 2009, 08:52 PM
PabloTwo's Avatar
PabloTwo Online
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 5,126
linuxfirefox
BEFORE
Code:
BASH:~/work/test/-> identify *
rotten_tree_effects2.jpg JPEG 1152x864 1152x864+0+0 DirectClass 8-bit 335.006kb 
rotten_tree_effects.jpg[1] JPEG 1152x864 1152x864+0+0 DirectClass 8-bit 634.148kb 
rotten_tree_stump.jpg[2] JPEG 1152x864 1152x864+0+0 DirectClass 8-bit 627.027kb
Code:
BASH:~/work/test/-> mogrify *.jpg -quality 60
AFTER
Code:
BASH:~/work/test/-> identify *
rotten_tree_effects2.jpg JPEG 1152x864 1152x864+0+0 DirectClass 8-bit 85.0938kb 
rotten_tree_effects.jpg[1] JPEG 1152x864 1152x864+0+0 DirectClass 8-bit 226.352kb 
rotten_tree_stump.jpg[2] JPEG 1152x864 1152x864+0+0 DirectClass 8-bit 220.514kb
Again, the example above replaces the original files, so you would need to work with copies of the originals in another directory in order to preserve the original image files. But, if you study the command line options, there is probably an easy way to save the converted files under another name.

Do 'convert --help' or 'man convert' and 'man mogrify' to get an overview of the possibilities.

Last edited by PabloTwo; 11th November 2009 at 08:56 PM.
Reply With Quote
Reply

Tags
batch, files, jpeg, program, reduces, size

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Corrupt JPEG files pradeepjey Using Fedora 2 23rd May 2008 09:47 AM
How to make a batch file to start program and close the old window? Archw Using Fedora 5 15th May 2007 10:35 PM
Fix Corrupt Jpeg Jpg Files saki Using Fedora 0 3rd May 2007 05:30 AM
Batch Removing files :( rm ?? leoleMCH Using Fedora 6 10th January 2006 11:40 PM


Current GMT-time: 04:26 (Tuesday, 21-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat