% CMY color components of a 4x4 RGB subimage 
clear
%
xr=double([245  246  246  248;
  246  247  246  247;
  246  246  245  248; 
  248  247  246  248])/255; % normalized red component 
xg=double([191  196  193  190;
  192  197  192  189;
  192  197  192  189; 
  192  198  191  188])/255; % normalized green component  
xb=double([222  225  223  223;
  223  226  223  222;
  223  225  222  222; 
  223  224  221  224 ])/255; % normalized blue component 
xcmy=cat(3,1-xr,1-xg,1-xb); % RGB2CMY
% CMY components of a 4x4 RGB subimage 
xc=round(255*xcmy(1:4,1:4,1)) % cyan component
xm=round(255*xcmy(1:4,1:4,2)) % magenta component
xy=round(255*xcmy(1:4,1:4,3)) % yellow component
% imcoplement function can also be used
% for this conversion