フィルターのクリア

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

4 ビュー (過去 30 日間)
경현
경현 2024 年 4 月 3 日
コメント済み: 경현 2024 年 4 月 3 日
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.

採用された回答

Angelo Yeo
Angelo Yeo 2024 年 4 月 3 日
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 件のコメント
경현
경현 2024 年 4 月 3 日
Thank you very much for your help.
have a good day.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStandard File Formats についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by