How can a change image format like .jpg to .png by using loops and with out use of 'imwrite' command

조회 수: 10 (최근 30일)
In MATLAB we have a command "IMWRITE" to change the format but my problem is what's going behind, when we are using 'IMWRITE' command in the program.

답변 (2개)

Stephen23
Stephen23 2017년 4월 1일
편집: Stephen23 2017년 4월 3일
imwrite does not require any toolboxes (it is standard MATLAB), so why do you not want to use it?
If you want an alternative, consider Oliver Woodford and Yair Altman's highly regarded FEX submission:
  댓글 수: 3
Image Analyst
Image Analyst 2017년 4월 1일
Then you'll have to look up the official format and use fwrite() to write out the image "manually" byte by byte yourself, that is, if you're allowed to use fopen(), fwrite(), and fclose().
Walter Roberson
Walter Roberson 2017년 4월 1일
Please post the specific requirements of the project. There is no point in our making proposals that might be rejected because you forgot to mention a restriction.
For example if the reason you cannot use imwrite is that you need generate code for an FPGA and that does not support imwrite then that would be important information because FPGA does not support file i/o at all.

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


KSSV
KSSV 2017년 4월 1일
You can rename your image file .jpg to .png. doc movefile.
  댓글 수: 8
Stephen23
Stephen23 2017년 4월 1일
편집: Stephen23 2017년 4월 1일
>> X = ones(1,1,3)/2;
>> imwrite(X,'test.jpg','jpg');
>> S = imfinfo('test.jpg'); S.Format
ans =
jpg
>> movefile('test.jpg','test.png')
>> S = imfinfo('test.png'); S.Format
ans =
jpg
Changed the file extension, no change in file format.
To Anyone Else: this "answer" does not work
KSSV
KSSV 2017년 4월 3일
@ Stephen Cobeldick
I have checked renaming file within matlab and without matlab and then used iminfo, yes the format didn't change.
Your doctorate should have taught you that you can investigate things like this yourself: it would only take one minute. I was renaming image files like this earlier for web uploads, I was in misconception. Thank you for for the point.

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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by