How to Convert BMP images to JPEG?? (Properly!!!!)
11 views (last 30 days)
Show older comments
When I convert an image from BMP to JPEG using the code below:
BMP = imread('CYMR9_SCAP_VE_MEAS_FIB_MEASURE5_p003_2013-09-18_20-07-21.bmp','bmp');
imwrite(BMP,'CYMR9_SCAP_VE_MEAS_FIB_MEASURE5_p003_2013-09-18_20-07-21.jpg','jpg');
imageOriginal = imread('CYMR9_SCAP_VE_MEAS_FIB_MEASURE5_p003_2013-09-18_20-07-21.jpg');
it saves the image in my directory as 147KB. However when I open the original image in it's BMP format in Paint and save it manually as a JPEG it saves as the size 386KB!
I'm working with a function based around automated image processing and would prefer Matlab to convert the initial image to the size 386Kb (similar to manual conversion using paint) as when it's at the size 147KB my function doesn't work.
could anyone help solve this problem??
2 Comments
Image Analyst
on 23 Jan 2014
You don't need the second argument. It will figure out the format from the filename extension.
Answers (1)
Walter Roberson
on 23 Jan 2014
Play with the 'Mode' and 'Quality' options of imwrite(). Look in the imwrite() documentation under "Name-Value Pair Arguments"
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!