How to Convert BMP images to JPEG?? (Properly!!!!)

조회 수: 9 (최근 30일)
Cormac
Cormac 2014년 1월 23일
댓글: Cormac 2014년 1월 28일
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
Image Analyst
Image Analyst 2014년 1월 23일
You don't need the second argument. It will figure out the format from the filename extension.
Cormac
Cormac 2014년 1월 28일
I'm only seeing your comment to this question now, thanks for the tip!

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2014년 1월 23일
Play with the 'Mode' and 'Quality' options of imwrite(). Look in the imwrite() documentation under "Name-Value Pair Arguments"
  댓글 수: 1
Cormac
Cormac 2014년 1월 28일
Done a second conversion to convert from a gray scale JPEG to a true colour JPEG! thanks for the help.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by