%%  Read a color JPG image
J =imread('mrl_logo.jpg', 'JPG');
figure
imshow(J)



%%Save it in PPM and PGM formats

imwrite_ppm(J,'mrl_logo.ppm');
imwrite_pgm(J,'mrl_logo.pgm');



PPM = imread_ppm('mrl_logo.ppm');
PGM = imread_pgm('mrl_logo.pgm');

% Convert from PPM to PGM
% imwrite_pgm(PPM, 'mrl_logo2.pgm');

figure
imshow(PPM)

figure
imshow(PGM)
