Save image as grayscale with specified resolution
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Soda
el 15 de Nov. de 2019
Editada: Image Analyst
el 15 de Nov. de 2019
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 comentarios
Respuesta aceptada
Image Analyst
el 15 de Nov. de 2019
Editada: Image Analyst
el 15 de Nov. de 2019
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!