LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-16-2012, 05:56 AM   #16
vonbiber
Member
 
Registered: Apr 2009
Distribution: slackware 14.1 64-bit, slackware 14.2 64-bit, SystemRescueCD
Posts: 533

Rep: Reputation: 129Reputation: 129

with ImageMagick you can get the width and height of an image by running:
Code:
image=yourimage.png
width=$(identify -format '%w' $image)
height=$(identify -format '%h' $image)
Then you can use $width and $height as the dimensions of the picture you want to resize.
You can resize a picture so that its width and/or height doesn't go
beyond a certain dimension:
Code:
convert yourimage.png -resize '128x128>' resized.png
Check this web site for a lot of examples:
http://www.imagemagick.org/Usage/
 
Old 04-16-2012, 09:08 AM   #17
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,223

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
I've blogged something quite similar, getting the resolution and determining the aspect ratio and relocating the resized images and all:

http://duganchen.ca/converting-manga-to-kindle-format/

Quote:
I need to pass sucesively on each image in the directory himself and in directory that are inside the main one. Some time the image are even in a third or fourth directory
Use "find -exec".

Last edited by dugan; 04-16-2012 at 11:07 AM.
 
  


Reply



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
bash script: use the directory of the script file as variable? phling Linux - Newbie 12 01-16-2010 07:16 PM
To rename files in a directory should I use Bash script or a Perl Script ? jamtech Programming 7 01-22-2008 11:25 PM
Bash Script - Resize Cover.png Images XaViaR Linux - General 3 09-04-2006 12:29 PM
Bash script to strip a certain directory out of directories in a directory? rylan76 Linux - General 3 08-29-2006 11:35 AM
bash script to resize gnome terminal ? smoker Linux - General 1 03-17-2006 03:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:50 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
Open Source Consulting | Domain Registration