September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,7 @@
fcn toGrayScale(img){ // in-place conversion
foreach x,y in (img.w,img.h){
r,g,b:=img[x,y].toBigEndian(3);
lum:=(0.2126*r + 0.7152*g + 0.0722*b).toInt();
img[x,y]=((lum*256) + lum)*256 + lum;
}
}

View file

@ -0,0 +1,3 @@
img:=PPM.readPPMFile("lena.ppm");
toGrayScale(img);
img.write(File("foo.ppm","wb"));