Effacer les filtres
Effacer les filtres

How can i imwrite ppm image file as a ASCII Encoding format

5 vues (au cours des 30 derniers jours)
경현
경현 le 3 Avr 2024
Commenté : 경현 le 3 Avr 2024
After reading the PPM file and processing the data, and save it again using imwrite.
But I cant imwrite ppm image file as a ASCII Encoding format
So I cant properly using that ppm file.
For example,
a = imread("xxxx.ppm")
Iinfo1 = imfinfo('xxxx.ppm')
That file's FormatVersion : 'P3', Formatsignature : 'P3' and Encoding:'ASCII'
but after processing 'a' data, and store parameter 'b'
imwrite(b,'yyyy.ppm')
and Iinfo2 = imfinfo('yyyy.ppm')
That file's FormatVerison : 'P6', Formatsignature : 'P6' and Encoding:'rawbits'
I want imwrite .ppm file as a ASCII Encoding format
please help me.
I can't find any solution on the Internet
I'm sorry for the lack of readability because My English skill are not good
Thanks for reading.

Réponse acceptée

Angelo Yeo
Angelo Yeo le 3 Avr 2024
a = imread("sample.ppm");
imwrite(a, "save_sample.ppm","ppm", "Encoding","ASCII")
imginfo = imfinfo("save_sample.ppm")
imginfo =
struct with fields:
Filename: 'C:\Workspace\q2102176\save_sample.ppm'
FileModDate: '03-Apr-2024 15:37:25'
FileSize: 2800776
Format: 'PPM'
FormatVersion: 'P3'
Width: 640
Height: 426
BitDepth: 24
ColorType: 'truecolor'
FormatSignature: 'P3'
Encoding: 'ASCII'
MaxValue: 255
ImageDataOffset: 15
  1 commentaire
경현
경현 le 3 Avr 2024
Thank you very much for your help.
have a good day.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by