Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let processImage f (path:string) =
- let bitmap_in = new Bitmap(path)
- let bitmap_out = new Bitmap(bitmap_in.Width, bitmap_in.Height)
- let filename = Path.GetFileName(path)
- for i in 0..(bitmap_in.Width-1) do
- for j in 0..(bitmap_in.Height-1) do
- bitmap_out.SetPixel(i,j,bitmap_in.GetPixel(i,j))
- bitmap_out |> f
- bitmap_out.Save(Path.Combine(Path.GetDirectoryName(path), filename.Insert(filename.Length - 4, "-1")),
- ImageFormat.Jpeg)
- bitmap_in.Dispose()
- bitmap_out.Dispose()
- let mirrorTrans (image: Bitmap) =
- for i in 0..(image.Height-1) do
- for j in 0..(image.Width-1) do
- let pix = min (image.Width - 1) (max 0 (j + int (sin(float i / 20.0) * 30.0)))
- image.SetPixel(j, i, image.GetPixel(pix,i))
- processImage mirrorTrans @"/Users/emilfataliev/Desktop/F#/fp-lab4-EmilFataliev/images/selfi.jpg"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement