LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 11-15-2003, 06:19 AM   #1
mikeshn
Member
 
Registered: Feb 2002
Distribution: Fedora Core 2
Posts: 586

Rep: Reputation: 30
Resize image


I need to resize image. The file size is 2272x1704 JPEG format. I want to resize to size 320x240.

/usr/bin/X11/convert -size 100X100 file.jpeg -resize 340x240 file.jpeg
The result after is wrong size. Any ideas what is wrong with the command?
 
Old 11-15-2003, 06:55 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
There's nothing wrong with the command. But convert does keep the aspect ratio of the original picture. You can 'force' convert to calculate the correct ratio:

convert -size 1463x973 example.jpg -resize 640 example.resized.jpg

will give you a resized picture that is 640 (you provided this) by 426 (calculated by convert)

convert -size 1463x973 example.jpg -resize 640x480 example.resized.jpg

Will have the same result.......
 
Old 11-15-2003, 09:06 AM   #3
mikeshn
Member
 
Registered: Feb 2002
Distribution: Fedora Core 2
Posts: 586

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by druuna
There's nothing wrong with the command. But convert does keep the aspect ratio of the original picture. You can 'force' convert to calculate the correct ratio:

convert -size 1463x973 example.jpg -resize 640 example.resized.jpg

will give you a resized picture that is 640 (you provided this) by 426 (calculated by convert)

convert -size 1463x973 example.jpg -resize 640x480 example.resized.jpg

Will have the same result.......
I have a picutre 2272x1704 and when I resize it

/usr/bin/convert -size 1704x2272 example.JPEG -resize 320x240 example.jpeg

The result of this is picture 240x180 .. What I'm doing wrong ?
I need picture 320x240

Thanks
 
Old 11-15-2003, 09:54 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
LOL

2272x1704 or 1704x2272 which one is it???

2272x1704 = 4:3 = 320x240
1704x2272 = 3:4 = 240x320

convert -size 2272x1704 example.JPEG -resize 320x240 example.jpeg
convert -size 1704x2272 example.JPEG -resize 240x320 example.jpeg

Hope this helps.
 
Old 11-15-2003, 10:36 AM   #5
mikeshn
Member
 
Registered: Feb 2002
Distribution: Fedora Core 2
Posts: 586

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by druuna
LOL

2272x1704 or 1704x2272 which one is it???

2272x1704 = 4:3 = 320x240
1704x2272 = 3:4 = 240x320

convert -size 2272x1704 example.JPEG -resize 320x240 example.jpeg
convert -size 1704x2272 example.JPEG -resize 240x320 example.jpeg

Hope this helps.
Original Size: 1704x2272

I need picture of size 320x240. No matter what , after I resize picture I got picture 240x320..

convert -size 1704x2272 example.jpg -resize 320x240 example.jpeg
convert -size 1704x2272 temp.jpg -resize 240x320 temp.jpeg
 
Old 11-15-2003, 11:43 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Like I said before, convert respects the ratio of the original image. It cannot do what you ask for.

Use mogrify (from the same ImageMagic toolkit).

mogrify -resize 340x320 inputfile.jpg

You might have noticed the lack of an outputfile.jpg. There is none. The original is overwritten!
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resize HDD image thesystem Linux - General 1 10-02-2005 03:28 PM
USB stick boot image resize problem beady Linux - Hardware 2 07-27-2005 02:36 PM
image resize oldstinkyfish Linux - Software 4 12-16-2004 06:00 AM
Resize Image using ImageMagick mddolloff Linux - Software 1 11-20-2004 05:07 PM
batch image resize and compression Darkfalz Linux - Software 3 08-01-2004 02:08 AM


All times are GMT -5. The time now is 09:34 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration