Bash: How to convert whatever size pnm file to a jpg of 2.0mb ?
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
From frenchnoob---I don't think so. But you got the real question right: Why??
I think that the intent here is to convert format and make the file smaller. I was surprised to find out that you can specify the target pixel count.....
From frenchnoob---I don't think so. But you got the real question right: Why??
H_TeXMeX_H was right ...
Frenchn00b is a geek, real one, that talks badly english..
even he's making progresses in linux with trying hard all kind of things with linux.
So I found those ways:
- convert/imagemagick
man convert
gives -resize geometry
but we can screw up the shapes of the pic
beware because it can after the quality of the pic... not so perfect always... still fighting
Quote:
convert dragon.gif -resize 50% half_dragon.gif
... still looking
Last edited by frenchn00b; 01-18-2009 at 01:27 PM.
I think I see what you are trying to do now, you're trying to scale down a picture to be under 2 MB right ? or does it have to be exactly 2 MB in size ?
Indeed you would need to try to calculate the size of the file with respect to the pixel count. So, take several files and see what size they have, then divide it by the pixel count = width x height. You'll get an estimate of bytes per pixel ... I'm not sure how jpeg compression works, but this may not be the same for every picture. It may just turn out to be 24 or 32, who knows.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.