How to resize jpg image through matlab to EXACT 300kb file size

2 visualizaciones (últimos 30 días)
hadiqa khan
hadiqa khan el 1 de Sept. de 2018
Comentada: Walter Roberson el 1 de Sept. de 2018
i have an image of 297kb but for some reasons i want it to be in exact 300kb for uploading else it will not be uploaded. how do i code from scratch from uploading pic to matlab to rsize it to 300 kb. please help urgent:)

Respuestas (2)

ahmed nebli
ahmed nebli el 1 de Sept. de 2018
u can use the function imresize like this link https://www.mathworks.com/help/images/ref/imresize.html but u need to know how many rows and colums are in 300kb

Image Analyst
Image Analyst el 1 de Sept. de 2018
Whether or not you can do this depends on the size of your image, how big the header info is, and if you're using compression or not. I'd recommend you NOT use compression, like used by JPG and PNG formats because those formats will give you variable sizes. You're better off using BMP or TIFF formats, but even then you'll have to figure out how big the header is. So use imresize() to shrink your image until it's just below 300,000 bytes, then you'll have to add some padding to some of the header tags to get it up to exactly 300,000 bytes.

Categorías

Más información sobre Images en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by