Borrar filtros
Borrar filtros

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

5 visualizaciones (últimos 30 días)
경현
경현 el 3 de Abr. de 2024
Comentada: 경현 el 3 de Abr. de 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.

Respuesta aceptada

Angelo Yeo
Angelo Yeo el 3 de Abr. de 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

Más respuestas (0)

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by