Resizing images within a specific file size constraint
Posted: 2010-10-29T01:05:29-07:00
Hello.
I have searched the boards, read the FAQ and the guides, but am still unable to locate an answer to what I thought was a simple problem:
I have a number of jpg and png files that I need to somehow resize in such a way that they can fit within a file size constraint of 256 KB (final file size must be <256.000 bytes, to be on the safe side). The files are of various sizes and bit depths (from various sources).
Additionally:
* While I would like to have them always be below 256 KB in size, I would also like to preserve as much quality as possible.
* The image file type must remain the same (jpg must remain jpg, png must remain png), because the files will be referenced by their original names.
* I would like to remove any excess bit depth that cannot be displayed on screen, as the final images will be used exclusively for web.
* Original aspect ratio should be preserved.
The only way I have found so far is to resize all the images to a very tiny, nearly thumbnail, size. Because if I relax the constraint even a little bit, a few of the images end up being a bit larger than the 256 KB.
Is this possible with greater knowledge of either imagemagick or picture formats than mine? I suspect it should be possible to define a "perfect format" that will enforce all of this, but I have nowhere near the know-how to find it.
I have searched the boards, read the FAQ and the guides, but am still unable to locate an answer to what I thought was a simple problem:
I have a number of jpg and png files that I need to somehow resize in such a way that they can fit within a file size constraint of 256 KB (final file size must be <256.000 bytes, to be on the safe side). The files are of various sizes and bit depths (from various sources).
Additionally:
* While I would like to have them always be below 256 KB in size, I would also like to preserve as much quality as possible.
* The image file type must remain the same (jpg must remain jpg, png must remain png), because the files will be referenced by their original names.
* I would like to remove any excess bit depth that cannot be displayed on screen, as the final images will be used exclusively for web.
* Original aspect ratio should be preserved.
The only way I have found so far is to resize all the images to a very tiny, nearly thumbnail, size. Because if I relax the constraint even a little bit, a few of the images end up being a bit larger than the 256 KB.
Is this possible with greater knowledge of either imagemagick or picture formats than mine? I suspect it should be possible to define a "perfect format" that will enforce all of this, but I have nowhere near the know-how to find it.