LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-26-2009, 03:41 AM   #1
Chenchu
Member
 
Registered: Nov 2009
Location: Mars
Distribution: CentOS
Posts: 50

Rep: Reputation: 20
resizing pictures with ImageMagick


hey everyone,
I found this app for resizing images. for some reason my camera took pictures in huge sizes (3000+ pixels) and I need to resize them to a normal size. so, I found this prog which does a great job with the 'convert' command.

i'm trying to make it convert all the pictures in one command.
its syntax is: convert -resize size pic.jpg newpic.jpg

I tried by this: ls > convert -resize 800 ..
but i've no idea how to specify its output. any ideas?
 
Old 12-26-2009, 03:54 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Congratulations on discovering one of the major power tools!!

First, your camera has settings to control the output file size. Personally, I alway set it on the highest quality (largest file) and then downsize later.

From your command, it appears you are trying to do batch resizing. Try it your way, and I think it will simply assign its own filenames in some undesirable way. Much better to loop thru the folder---something like this:

<<untested>>
Code:
for pic in *; do
    convert -resize <size> $pic ${pic}new
done
 
Old 12-26-2009, 03:57 AM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
A google search at www.google.com/linux (for Linux related searchs) turns up quite a bit about resizing with Imagemagick. Just search for: imagemagick howto resize
 
Old 12-26-2009, 04:01 AM   #4
Chenchu
Member
 
Registered: Nov 2009
Location: Mars
Distribution: CentOS
Posts: 50

Original Poster
Rep: Reputation: 20
Thanks.. I think its working now. by saying batch you mean write a shell script right?
and can you please explain a lil bit how this small script works?
how does the var $pic gets its value?

thanks again, much appericiated.
saved me tons of time now editing them one by one
 
Old 12-26-2009, 04:10 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
The for loop assigns as value to the stated variable each time thru the loop.

General syntax:
for <variablename> in <expression>; do
<stuff to do>
done

<expression> can be as simple as the "*" (in this context meaning "everything I can see") or it can be the result of a command

Suppose you wanted only the files with names starting with "G". The loop would start with:

for <variablename> in $(ls|grep "^G")


For more on BASH scripting, head over to http://tldp.org and get the Bash Guide for Beginners
 
Old 12-26-2009, 04:17 AM   #6
Chenchu
Member
 
Registered: Nov 2009
Location: Mars
Distribution: CentOS
Posts: 50

Original Poster
Rep: Reputation: 20
thanks alot pixellany for the explanation.
 
Old 12-26-2009, 04:30 AM   #7
cola
Senior Member
 
Registered: Sep 2007
Posts: 1,034

Rep: Reputation: 65
Quote:
Originally Posted by Chenchu View Post
hey everyone,
I found this app for resizing images. for some reason my camera took pictures in huge sizes (3000+ pixels) and I need to resize them to a normal size. so, I found this prog which does a great job with the 'convert' command.

i'm trying to make it convert all the pictures in one command.
its syntax is: convert -resize size pic.jpg newpic.jpg

I tried by this: ls > convert -resize 800 ..
but i've no idea how to specify its output. any ideas?
Got something here:
http://polishlinux.org/apps/graphics...h-imagemagick/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Resizing pictures in mplayer linuxhippy Linux - Software 2 03-21-2008 05:13 PM
LXer: Enchanting Pictures with ImageMagick LXer Syndicated Linux News 0 05-10-2007 03:01 PM
Automaticlly resizing pictures for website? fredgt Linux - Software 3 09-03-2004 02:45 AM
Resizing Pictures command line eggoz Linux - General 2 02-29-2004 06:38 PM
Resizing pictures dancar Linux - General 3 02-24-2004 05:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:11 PM.

Main Menu
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