
currdir = dir;
cnt = 1;
savefilename = 'test.gif';
for i = 1:length(currdir)
	
	pngtest = strfind(currdir(i).name,'.png');
	
	if ~isempty(pngtest)
		[raw_mapidx,pngcolormap] = imread(currdir(i).name);
		
		if ndims(raw_mapidx) == 3
			[raw_mapidx,pngcolormap] = rgb2ind(raw_mapidx,256);
			
		end
		
		
		mapidx = imresize(raw_mapidx,8,'nearest');
		if cnt == 1
			imwrite(mapidx,pngcolormap,savefilename,'gif','Loopcount',inf);
			
		else
			imwrite(mapidx,pngcolormap,savefilename,'gif','WriteMode','append');
		end
		cnt = cnt + 1;
		
		
	end
	
	
	
	
end