How can a change image format like .jpg to .png by using loops and with out use of 'imwrite' command
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Stephen23
el 1 de Abr. de 2017
Editada: Stephen23
el 3 de Abr. de 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 comentarios
Image Analyst
el 1 de Abr. de 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
el 1 de Abr. de 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
el 1 de Abr. de 2017
You can rename your image file .jpg to .png. doc movefile.
8 comentarios
Stephen23
el 1 de Abr. de 2017
Editada: Stephen23
el 1 de Abr. de 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
el 3 de Abr. de 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.
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!