LinuxQuestions.org
Visit Jeremy's Blog.
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, 04: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, 04:54 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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, 04:57 AM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Jessie 8.4
Posts: 5,873

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
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, 05: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, 05:10 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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, 05: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, 05:30 AM   #7
cola
Senior Member
 
Registered: Sep 2007
Location: Dhaka,Bangladesh
Distribution: Debian
Posts: 1,031

Rep: Reputation: 63
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 06:13 PM
LXer: Enchanting Pictures with ImageMagick LXer Syndicated Linux News 0 05-10-2007 04:01 PM
Automaticlly resizing pictures for website? fredgt Linux - Software 3 09-03-2004 03:45 AM
Resizing Pictures command line eggoz Linux - General 2 02-29-2004 07:38 PM
Resizing pictures dancar Linux - General 3 02-24-2004 06:22 PM


All times are GMT -5. The time now is 05:13 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration