function count = getCount(im,parkey) if nargin<2 tag=''; else tag=num2str(parkey); end im=mat2gray(im); im=gray2ind(im); fname = ['e:\scratch\scratch_' tag '.jp2']; imwrite(im,fname,'mode','lossless'); info=imfinfo(fname); count=info.FileSize;