save large image/figure

34 views (last 30 days)
George Valdes
George Valdes on 19 May 2015
Edited: Keyes34 on 30 Jun 2015
I have a large mxn (~300,000 x 75) element matrix that I would like to save as an image or pdf without any compression. I'm currently using imagesc() to display. I've used the print function to set my own resolution but I'm having difficulty achieving the desired result. The image is a large time series that I would like to save in such a way that I may zoom in over a region, and transmit the complete series to others without any losses. Is there a simple method to save large , essentially banner sized, images / figures?

Accepted Answer

Image Analyst
Image Analyst on 19 May 2015
Why not save it as a PNG format image file with imwrite()?
Or just save the variable as a .mat file with save()?
Image Analyst
Image Analyst on 20 May 2015
Well the easiest way to do that is with the Image Processing Toolbox which you said you don't have. You would be able to use functions like rgb2ind() and ind2rgb(). You can do it manually without too much trouble though if you know how you want to quantize your colors. rgb2ind() helps out there because it figures out the colormap and indexes for you.

Sign in to comment.

More Answers (2)

Ingrid on 19 May 2015
I always use the export_fig figure for saving images since this doesn't crop the figure so you might want to look at this?

George Valdes
George Valdes on 19 May 2015
Edited: George Valdes on 19 May 2015
I'm able to get the export_fig function to output images (even though some of the options seem to have a compatibility issue with 2015a. However, the higher resolution images it's giving me are "higher resolution" of the compressed figure's image. Meaning I'm still unable to zoom in on the image and see the original data. the -native and -q options from what I've read aren't handling the 2015.
%%update: I see what's happening here I believe. when displaying the image I get a warning saying "too big to fit on screen displaying at 1%" so the data is being compressed to fit the figure size. The usual commands will only save images of this compressed data. I don't particularly care about displaying it, I need a way to save the 100% scale data as an image to view with windows photo-viewer.%%
Keyes34 on 30 Jun 2015
Edited: Keyes34 on 30 Jun 2015
Oh. I see. Well then. Thought the guy's suggestion above would work.
To be honest, export_fig was mainly for this part of my code. Contour lines don't appear in imwrite, but they do in export_fig.
figure,imshow(RGBImage); hold on; %Hold for contour lines.
contour(Marked_ROI,[0 0],'b','LineWidth',2); %hold off;tried here b4
%Marked_ROI is a binary image.
filename = sprintf('ROI_%s.bmp', Img{imageCount});
imwrite(RGBImage, filename);
hold off;

Sign in to comment.


Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!