pin = pfsopen("stdin");
pin = pfsget(pin);
while (!pin.EOF)
    if (length(pin.tags) > 0)
        disp("Tags:");
        disp(pin.tags);
    endif
    if (length(pin.channelTags.X) > 0)
        disp("Channel X tags:");
        disp(pin.channelTags.X);
    endif
    if (length(pin.channelTags.Y) > 0)
        disp("Channel Y tags:");
        disp(pin.channelTags.Y);
    endif
    if (length(pin.channelTags.Z) > 0)
        disp("Channel Z tags:");
        disp(pin.channelTags.Z);
    endif
    printf("Size: %dx%d\n",pin.columns,pin.rows);
    #disp(length(pin.channels.Y(:)(:)));
    [R G B] = \
        pfstransform_colorspace( \
            "XYZ", \
            pin.channels.X, \
            pin.channels.Y, \
            pin.channels.Z, \
            "RGB" \
        );
    if (false)
    for (y=1:pin.rows)
        for (x=1:pin.columns)
            if (R(y,x) == 0)
                printf("zero R at x=%d y=%d\n",x,y);
            endif
            if (G(y,x) == 0)
                printf("zero G at x=%d y=%d\n",x,y);
            endif
            if (B(y,x) == 0)
                printf("zero B at x=%d y=%d\n",x,y);
            endif
        endfor
    endfor
    endif
    printf("R: min=%f; max=%f\n",min(min(R)),max(max(R)));
    printf("G: min=%f; max=%f\n",min(min(G)),min(max(G)));
    printf("B: min=%f; max=%f\n",min(min(B)),min(max(B)));
    pin = pfsget(pin);
endwhile
pfsclose(pin);
