RosettaCodeData/Task/Grayscale-image/PL-I/grayscale-image.pli

12 lines
330 B
Text
Raw Permalink Normal View History

2013-04-10 22:43:41 -07:00
do j = 1 to hbound(image,1);
do i = 0 to hbound(image,2);
color = image(i,j);
R = substr(color, 17, 8);
G = substr(color, 9, 8);
B = substr(color, 1, 8);
grey = trunc(0.2126*R + 0.7152*G + 0.0722*B);
greybits = grey;
image(i,j) = substr(greybits, length(greybits)-7, 8);
end;
end;