function CreateRawImage(filename, dim)
    % CreateRawImage(filename, dim)
    % e.g. CreateRawImage('ramp.dat', 256) This is the size for Viset
    % E T Rolls https://www.oxcns.org  Jun 2016
    
    format compact;
    image = zeros(dim, dim);
    size(image)
 
    
%     for col = dim/2 -5 : dim/2 + 5
%         for row = 1 : dim
%             image(row, col) = 1;
%         end
%     end
    for col = 32 : dim - 32 % ramp
        for row = 16 : dim - 16
            scalef = 255 / ((dim -32) - 32);
            image(row, col) = col * scalef;
        end
    end
    figure(1)
    imagesc(image);
    
    %dims = [dim dim];
    fid = fopen(filename, 'w');
    fwrite(fid, image', '*uint8')';
    fclose(fid);
        
end