convert .fig to .jpg based on the ROI

Hi Sir, can I know how to save the .fig from matlab window to .jpg based on the desired result.this the image that I mentioned: http://www.flickr.com/photos/80166922@N06/7347715732/in/photostream
As u can see from the image, there is white area in the backgeound but I do not want the white are.Just want the region of interest (I mean the circular sign only). how should I eliminate the white background so that I can save it as .jpg for the ROI only. FYI, I save the image from .fig to .jpg in my current directory

 Accepted Answer

Export_fig automatically crops whitespace around figures by default. Download the files to somewhere on your MATLAB path, then, with the relevant figure open, call:
export_fig specific_directory/test.jpg -a1

10 Comments

sir,cud u pls explain which part shud I used.I simply dont understand which coding shud I read and used it in my coding.many thanks!!:)
Answer updated.
yeah its exactly works.however, before I export the fig.my resize image is 40x40..after using export_fig test.png the dimension turns to be 41x41. why it that...it supposed to 40x40 same to the resize image, isn't it?
sir, can I know after done export_fig, then how could I save that image in specific directory?
If you have an actual image then cropping it by saving the figure is not the way to go. Why don't you crop the actual image data you're plotting?
because the image is process, it is basically has complicated background.the above link(the image is the ROI).after do some pre-processing processes, I want to eliminate the whitespace background!
Use any() and find() to find the top and bottom rows, and the left and right columns. Then crop and save with imwrite().
can u give the code?cant understand.for example after I do [x,y]=find(image). then what shud I do..tq
See my updated answer.
what's the meaning of -a1

Sign in to comment.

More Answers (0)

Categories

Find more on Convert Image Type 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!