Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,21 @@
-- demo\rosetta\Bitmap_Greyscale.exw (runnable version)
function to_grey(sequence image)
integer dimx = length(image),
dimy = length(image[1])
for x=1 to dimx do
for y=1 to dimy do
integer pixel = image[x][y] -- red,green,blue
sequence r_g_b = sq_and_bits(pixel,{#FF0000,#FF00,#FF})
integer {r,g,b} = sq_floor_div(r_g_b,{#010000,#0100,#01})
image[x][y] = floor(0.2126*r + 0.7152*g + 0.0722*b)*#010101
end for
end for
return image
end function
--include ppm.e -- read_ppm(), write_ppm(), to_grey() (as distributed, instead of the above)
sequence img = read_ppm("Lena.ppm")
img = to_grey(img)
write_ppm("LenaGray.ppm",img)