imwrite saving image file without extension even after specifying the extension.
Show older comments
original= iin;
for hsize=3:2:9
for sigma=0.5:0.5:2
close all;
file1 =sprintf('Intern_log_plot%d_hsize=%d_sigma=%.1f',n,hsize,sigma);
file2 =sprintf('Intern_log%d_hsize=%d_sigma=%2f',n,hsize,sigma);
s1=sprintf('%s%s%s%d%s%s',image_folder,l,filenames(n).name,n,l,file1);
s2=sprintf('%s%s%s%d%s%s',image_folder,l,filenames(n).name,n,l,file2);
h=fspecial('log',hsize,sigma);
pic=imfilter(original,h);
figure;
subplot(2,2,1);
imshow(original);title('Raw Image');
subplot(2,2,2);
imshow(pic);title('Output');
colormap('default');
h=gcf;
saveas(h,s1,'jpg');
imwrite(pic,s2,'jpg');

The imwrite function writes the file to the disk as files without any extension(so the image file is not detected by image viewer softwares), with the format being already specified as 'jpg' in the imwrite function.
Accepted Answer
More Answers (1)
YADHUKRISHNAN
on 31 Jul 2014
0 votes
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!