Its not necessary that image needs to be present in ur folder. You can also take a look at this documentation to see how printing works without a display. imwrite (img, './ccc.bmp' ), datagetframe (figure ( 1 )) imwrite (data.cdata, './ddd.bmp' ) figurefigure imwrite (h2.CData, './fff.bmp') img figure ( 2) h3imshow (img, 'border', 'tight' ) figure fgetframe (figure ( 2 )) imwrite (f.cdata, './ggg. imwrite (A,filename,fmt) This is the general format of imwrite. ![]() ![]() You gave it a folder when it is asking for a file path. Print(gcf,'new_image.eps','-depsc2','-r300') %# Print the figure 1 the folder you give to imwrite does not contain a file name at the end user813853 at 18:36 Add a comment 2 Answers Sorted by: 2 Your call to imwrite has an invalid second parameter. 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. 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. Print('new_image.eps','-deps') %# Print the figure as a B&W eps MATLAB Function Reference imwrite Write image to graphics file Syntax imwrite(A,filename,fmt) imwrite(X,map,filename,fmt) imwrite(.,filename) imwrite(.,Param1,Val1,Param2,Val2.) Description imwrite(A,filename,fmt)writes the image in Ato filenamein the format specified by fmt. imwrite creates the new file in your current folder. ![]() 'InitialMagnification',100) %# a border at full magnification imwrite (A,filename) writes image data A to the file specified by filename, inferring the file format from the extension. eps using PRINT: img = imread('peppers.png') %# A sample image One possible solution is to plot your image using IMSHOW, then print the entire figure as a.
0 Comments
Leave a Reply. |