Skip to content

Added preserveFileType and transparencyFillColor

Compare
Choose a tag to compare
@TonyBrobston TonyBrobston released this 14 Oct 23:51
· 47 commits to master since this release
ee0ef20

In order to keep transparency working on png files, I've added a preserveFileType option. I noted the limitation in the readme, if this is kept compression will not work; the only way to effect file size will be through changing the dimensions of the image.

Also, when compressing pngs, which also converts them to jpeg; the transparent sections of the image were being replaced with black. I added an option called transparencyFillColor to allow a color to be passed in. This uses https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle under the hood, so anything it can do, this can do.