From: Dmitry Borovoy on 19 May 2010 00:42 I need to export figure to bmp or jpg format. I use following command: saveas(hF1,['C:\Users\Dimas\Desktop\a1.bmp'],'bmp'); Then I get bmp-file, but with 8-bit color depth. Then I try to save as jpg saveas(hF1,['C:\Users\Dimas\Desktop\a1.jpg'],'jpg'); And I get 24-bit image but with default paper size 1200*900 instead my 1900*300 Need help. I tryed to change PaperSize for jpg export: set(hF1, 'PaperUnits', 'points'); set(hF1, 'PaperSize', [1900 300]); but it did't help
From: Oliver Woodford on 19 May 2010 04:46 "Dmitry Borovoy" wrote: > I need to export figure to bmp or jpg format. I use following command: > saveas(hF1,['C:\Users\Dimas\Desktop\a1.bmp'],'bmp'); > Then I get bmp-file, but with 8-bit color depth. > Then I try to save as jpg > saveas(hF1,['C:\Users\Dimas\Desktop\a1.jpg'],'jpg'); > And I get 24-bit image but with default paper size 1200*900 instead my 1900*300 > Need help. > I tryed to change PaperSize for jpg export: > set(hF1, 'PaperUnits', 'points'); > set(hF1, 'PaperSize', [1900 300]); > but it did't help Try export_fig: http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig
From: Dmitry Borovoy on 19 May 2010 06:25 > Try export_fig: > http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig Thanks. It's really good function. But I have some questions. Now I stopped on the following code: set(hF1,'Color', 'white'); export_fig('C:\Users\Dimas\Desktop\a2.jpg','-jpg','-r150','-opengl',hF1); But when I use bmp format I've got error export_fig('C:\Users\Dimas\Desktop\a2.bmp','-bmp','-opengl',hF1); ??? Error using ==> print at 339 UIJ_AreThereWindowShowsPending - timeout waiting for window to show up Error in ==> print2array at 101 print(fig, renderer, ['-r' num2str(ceil(get(0, 'ScreenPixelsPerInch')*res))], '-dtiff', tmp_nam); Error in ==> export_fig at 277 A = print2array(fig, magnify, renderer); How to get lossless picture? And where I can set up size of my picture, or I have to change size of my figure and then export to picture?
From: Oliver Woodford on 19 May 2010 06:41 "Dmitry Borovoy" wrote: > > Try export_fig: > > http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig > > Thanks. It's really good function. But I have some questions. Now I stopped on the following code: > set(hF1,'Color', 'white'); > export_fig('C:\Users\Dimas\Desktop\a2.jpg','-jpg','-r150','-opengl',hF1); > > But when I use bmp format I've got error > export_fig('C:\Users\Dimas\Desktop\a2.bmp','-bmp','-opengl',hF1); > ??? Error using ==> print at 339 > UIJ_AreThereWindowShowsPending - timeout waiting for window to show up > > Error in ==> print2array at 101 > print(fig, renderer, ['-r' num2str(ceil(get(0, 'ScreenPixelsPerInch')*res))], > '-dtiff', tmp_nam); > > Error in ==> export_fig at 277 > A = print2array(fig, magnify, renderer); > > How to get lossless picture? > > > And where I can set up size of my picture, or I have to change size of my figure and then export to picture? The aspect ratio of the output is determined by the figure size. The size of the output is determined by a combination of the figure size and the -r or -m options. The default is for the output to be the same size (in pixels) as the figure on screen. So yes, you will need to change the size of the figure to get an exact ouput size. I don't know why there is an error when you saved to bmp, but I do believe it is not specific to the file format. Sometimes opengl throws up errors when using print - it's a reliability issue with that MATLAB function. You can email me the figure if you like. You can save losslessly to bmp, png or tif, and additionally jpg when using the -q101 option. Regards, Oliver
From: Dmitry Borovoy on 20 May 2010 01:32 Thanks a lot )
|
Pages: 1 Prev: Simulations needed for Silcon Waveguide Next: How to remove zero from matrix ? |