large_image
large_image copied to clipboard
Abstract output format compression options
We currently support some specific compression options (jpegQuality, jpegSubsampling, tiffCompression). If we want to support more output formats (e.g., #899), it'd be nice to abstract this to format independent values. For example, values might be "quality" (0-poor, 100-good), "lossless" (boolean), "mode" (internal mode value like lzw), "level" (0-fast, 100-slow and better).
I image a table with the known formats and a list of lambda that convert from the abstract properties to the format-specific properties for PIL. This would also be a good point to use other compression libraries (e.g., a wrapper around another PNG library would be faster than PIL).
One drawback to the sample values I listed is that it reduces specific tuning of formats (jpegSubsampling being the obvious example). The alternative is a generalized dictionary of encoder options, but then the caller needs to know specifics of which library is doing the encoding.