save from .jpg to .txt

5 views (last 30 days)
Tulips
Tulips on 6 Jul 2012
hi,can I know how to save .jpg file that contains pixels value to a .txt file. fyi, i'm not sure why my .txt file is empty after I save as .txt file and also use ascii syntax.thanks!

Answers (1)

Walter Roberson
Walter Roberson on 7 Jul 2012
MyImage = imread('MyJPEG.jpg');
save( 'MyTextJPEG.txt', 'MyImage', -ascii );
  1 Comment
Ravi Rahul Kumar Shah
Ravi Rahul Kumar Shah on 26 May 2022
it should be
MyImage = imread('MyJPEG.jpg');
save( 'MyTextJPEG.txt', 'MyImage', '-ascii' );

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!