Save image as grayscale with specified resolution
3 次查看(过去 30 天)
显示 更早的评论
Hello!
I want to save image (preferably jpg or tif) as grayscale with specified resolution(500 px * 500 px).
I converted image to gray scale and then blurred and added some noise. Following is what I tried
I = imread('sth.tif');
greyI = rgb2gray(I)
Iblur = imgaussfilt(greyI,1);
Inoise = imnoise(Iblur,'speckle',0.02);
inshow(Inoise)
saveas(Inoise,'image.tif')
However, when I try to save image using either imwrite, or saveas, it converts the image back to a color image and original resolution.
Thank you for your help in advance!
0 个评论
采纳的回答
Image Analyst
2019-11-15
编辑:Image Analyst
2019-11-15
saveas() saves a screenshot, which can be any resolution - you can drag the window to any size you want, right?
You should use imresize(Inoise, [500,500]) then imwrite() which saves the image itself with the actual pixel dimensions (rows and columns).
Inoise = imresize(Inoise, [500,500]) ;
imwrite(Inoise, 'image.tif');
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!