diff --git a/DeathSocket/ImageServices.fs b/DeathSocket/ImageServices.fs index e7ce9ac..8b077ab 100644 --- a/DeathSocket/ImageServices.fs +++ b/DeathSocket/ImageServices.fs @@ -17,8 +17,11 @@ Point ((interval * point), height)|]|] let drawGrid spec = - let img = Bitmap.FromFile spec.originalPath + // The originalImg is for images with indexed pixels. + let orignialImg = Bitmap.FromFile spec.originalPath + let img = new Bitmap (orignialImg.Width, orignialImg.Height) let graphics = Graphics.FromImage img + graphics.DrawImage (orignialImg, 0, 0) let pen = new Pen (spec.colour, width = spec.penWidth) let horizontalLines = createHorizontalLines (img.Size.Width) (img.Size.Height) (spec.rows) @@ -27,6 +30,7 @@ for line in horizontalLines do graphics.DrawLines (pen, line) for line in verticalLines do graphics.DrawLines (pen, line) img.Save (spec.savePath, ImageFormat.Png) + orignialImg.Dispose () img.Dispose () graphics.Dispose () pen.Dispose () \ No newline at end of file