How to resize jpg image through matlab to EXACT 300kb file size
1 次查看(过去 30 天)
显示 更早的评论
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:)
回答(2 个)
ahmed nebli
2018-9-1
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
0 个评论
Image Analyst
2018-9-1
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!