extensions

This commit is contained in:
Ryan Oldenburg 2020-11-21 20:02:57 -06:00
parent df0756941c
commit 137a832c3a

View file

@ -54,9 +54,9 @@ proc writeFile*(image: Image, filePath: string, fileFormat: FileFormat) =
proc writeFile*(image: Image, filePath: string) =
## Writes an image to a file.
let fileFormat = case splitFile(filePath).ext:
of "png": ffPng
of "bmp": ffBmp
of "jpg": ffJpg
of ".png": ffPng
of ".bmp": ffBmp
of ".jpg": ffJpg
else:
raise newException(PixieError, "Unrecognized file extension")
image.writeFile(filePath, fileformat)