summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/toolbox/toolbox_basic/io/ppmtojpg.m
blob: ce47e4571d86a8e9642c11f5e0e1ba37d1d5c02b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function []= ppm2jpg(fname,dlm,ori)
%
%  ppm2jpg(fname,dlm,ori)
%      
%     dlm =1, remove the file extension from fname
%             before convert
%     ori =1, transpose the image
%

if dlm,
 dlm = findstr(fname,'.');
 fname = fname(1:dlm(end)-1);
end

fname_1 = sprintf('%s.ppm',fname);
I = readppm(fname_1);

if ori == 1,
  I = permute(I,[2 1 3]);
end


fname_2 = sprintf('%s.jpg',fname);
imwrite(I,fname_2,'jpeg','Quality',90);