High Resolution / Quality .gif

5 views (last 30 days)
Ludwig
Ludwig on 17 Feb 2015
Commented: Jan on 17 Feb 2015
Dear all,
I want to change the resolution of my .gif. Creating the .gif is no problem, here is an code example (source: http://stackoverflow.com/questions/11051307/approaches-to-create-a-video-in-matlab):
%# figure
figure, set(gcf, 'Color','white')
Z = peaks; surf(Z); axis tight
set(gca, 'nextplot','replacechildren', 'Visible','off');
%# preallocate
nFrames = 20;
f = getframe(gca);
[f,map] = rgb2ind(f.cdata, 256, 'nodither');
mov = repmat(f, [1 1 1 nFrames]);
%# create movie
for k=1:nFrames
surf(sin(2*pi*k/20)*Z, Z)
f = getframe(gca);
mov(:,:,1,k) = rgb2ind(f.cdata, map, 'nodither');
end
close(gcf)
%# create GIF and open
imwrite(mov, map, 'myPeaks4.gif', 'DelayTime',0, 'LoopCount',inf)
winopen('myPeaks4.gif')
But how to change the quality of the .gif? Thanks a lot!

Answers (1)

Jan
Jan on 17 Feb 2015
GIF use a lossless compression. Therefore you cannot change the "quality".
  3 Comments
Ludwig
Ludwig on 17 Feb 2015
Like normal:
figure('units','normalized','position',[0.1 0.1 0.2 0.2])
Jan
Jan on 17 Feb 2015
Or when you catch the axes object as in your code, set the axes' position accordingly:
axes('Units', 'pixels', 'Position', [10, 10, 100, 200]);

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!