How can a change image format like .jpg to .png by using loops and with out use of 'imwrite' command
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponses (2)
Stephen23
le 1 Avr 2017
Modifié(e) : Stephen23
le 3 Avr 2017
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 commentaires
Image Analyst
le 1 Avr 2017
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
le 1 Avr 2017
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
le 1 Avr 2017
You can rename your image file .jpg to .png. doc movefile.
8 commentaires
Stephen23
le 1 Avr 2017
Modifié(e) : Stephen23
le 1 Avr 2017
>> 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
le 3 Avr 2017
@ 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.
Voir également
Catégories
En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!