LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Resize image (https://www.linuxquestions.org/questions/linux-general-1/resize-image-116278/)

mikeshn 11-15-2003 06:19 AM

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?

druuna 11-15-2003 06:55 AM

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.......

mikeshn 11-15-2003 09:06 AM

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

druuna 11-15-2003 09:54 AM

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.

mikeshn 11-15-2003 10:36 AM

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

druuna 11-15-2003 11:43 AM

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!


All times are GMT -5. The time now is 02:44 PM.