Constraints

jetviper21 edited this page Jun 12, 2011 · 1 revision

#Constraints

Example

{:compression => Zlib::BEST_COMPRESSION}

The constraints to use when encoding the canvas.

This can either be a hash with different constraints, or a symbol which acts as a preset for some constraints. If no constraints are given, ChunkyPNG will decide
for itself how to best create the PNG datastream.

  • Supported presets are :fast_rgba for quickly saving images with transparency, :fast_rgb for quickly saving opaque images, and :best_compression to obtain the smallest possible filesize.
  • :color_mode The color mode to use. Use one of the ChunkyPNG::COLOR_* constants.
  • :interlace true or false
  • :compression 0 - 9, or the Zlib constants such as Zlib::BEST_COMPRESSION
  • :bit_depth The bit depth to use. This option is only used for indexed images, in which case it overrides the determined minimal bit depth. For all the other color modes, a bit depth of 8 is used.