Allow quality to be configurable

In images with few colors (such as a 4-color palette), a high value would remove most of the detail, resulting in a nearly flat/blank image.