DynamicImage is JuicyPixels’ runtime image representation. It preserves the image’s bit depth and color model, allowing grayscale and RGB images to share an output type. section 13.1.1 section 13.3.2
Its constructors distinguish the supported image forms:
- ImageY8 and ImageY16 represent 8-bit and 16-bit grayscale images. section 13.3.2
- ImageRGB8 and ImageRGB16 represent 8-bit and 16-bit color images. section 13.3.2
- The type is a simple algebraic data type rather than a GADT or existential wrapper. section 13.3.2
Converting a PNM image for PNG output
A conversion function pattern-matches on the dynamic PNM image, builds an Image value with generateImage, and selects the matching DynamicImage constructor. The resulting value can be written with writeDynamicPng. section 13.3.2
