How to save png images into one tiff file format with export_fig?

2 views (last 30 days)
Dear all,
I have images in png format and I would like to save these images into one tiff. I found function export_fig at this link: http://www.mathworks.com/matlabcentral/fileexchange/23629-export-fig But I don´t know, where I can put images for transfer to tiff. I try this in export_fig.m:
fig = get(0, 'Binarizace_okoli_ 1.png');
[fig, options] = parse_args(nargout, fig, varargin{:});
but this is only one (first) image of my images.
Even so this error appears:
Error using get
There is no Binarizace_okoli_ 1.png property on the Root class.
Error in export_fig (line 265)
fig = get(0, 'Binarizace_okoli_ 1.png');
Can you advice me, where I put or load my images to transfer into tiff?
Thank you for your answers.

Answers (1)

Walter Roberson
Walter Roberson on 22 Apr 2017
projectdir = '.'; %name of folder where images are
output_tiff = 'MyMultipage.tif';
dinfo = dir( fullfile(projectdir, '*.png') );
filenames = fullfile(projectdir, {dinfo.name} );
for K = 1 : length(filenames)
this_data = imread(filenames{K});
if K == 1
imwrite(this_data, output_tiff);
else
imwrite(this_data, output_tiff, 'WriteMode', 'append');
end
end
This has nothing to do with export_fig()

Categories

Find more on File Operations 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!