Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -0,0 +1,13 @@
|
|||
using Color, Images, FixedPointNumbers
|
||||
|
||||
const M_RGB_Y = reshape(Color.M_RGB_XYZ[2,:], 3)
|
||||
|
||||
function rgb2gray(img::Image)
|
||||
g = red(img)*M_RGB_Y[1] + green(img)*M_RGB_Y[2] + blue(img)*M_RGB_Y[3]
|
||||
g = clamp(g, 0.0, 1.0)
|
||||
return grayim(g)
|
||||
end
|
||||
|
||||
ima = imread("bitmap_read_ppm_in.ppm")
|
||||
imb = convert(Image{Gray{Ufixed8}}, ima)
|
||||
imwrite(imb, "bitmap_read_ppm_out.png")
|
||||
Loading…
Add table
Add a link
Reference in a new issue