


For example, you can print your figure as an Encapsulated Level 2 Color PostScript with a resolution of 300 dpi by doing the following: print('new_image.eps','-depsc2','-r300') ĮDIT: If you are unable to use IMSHOW (either because you don't have the Image Processing Toolbox or because you are using a MATLAB mode that doesn't allow it), here is an alternative way to create and print the figure: img = imread('peppers.png') %# A sample image However, you can adjust the final resolution of the saved image using the -r option for the PRINT function. Some viewers may do that by only displaying the low bits, other the high bits, which depending on the image may result in everything black. Since most displays are only 8 bits, viewers have to convert the 16 bits to 8.
#Matlab iwrite how to#
Support for reading and displaying 16 bit images is also variable. Digital Image Processing Using MATLAB How to Read, Write & Display Images in MATLAB IntellCity 5. One drawback to this solution is that if the image is too big to fit on the screen, IMSHOW will shrink it to fit, which will reduce the on-screen resolution of the image. The only ones available to imwrite are JPEG, PNG and TIFF. Print('new_image.eps','-deps') %# Print the figure as a B&W eps 1 Answer Sorted by: 2 You must specify the BitDepth option when saving JPEG images with more than 8-bits: note that 16-bit only accepts grayscale images img imread peppers. 'InitialMagnification',100) %# a border at full magnification eps using PRINT: img = imread('peppers.png') %# A sample image imwrite(X,map,filename,fmt)writes the indexed image in Xand its associated colormap mapto filenamein the format specified by fmt. One possible solution is to plot your image using IMSHOW, then print the entire figure as a. 1 Answer Sorted by: 2 You must specify the BitDepth option when saving JPEG images with more than 8-bits: note that 16-bit only accepts grayscale images img imread ('peppers.png') imwrite (im2uint16 (img), '12bit.jpg', 'BitDepth',12) imwrite (rgb2gray (im2uint16 (img)), '16bit.
