lib/chunky_png/palette.rb
# Determines the minimal bit depth required for an indexed image
# @return [Integer] Number of bits per pixel, i.e. 1, 2, 4 or 8, or nil if
#   this image cannot be saved as an indexed image.
Determines the minimal bit depth required for an indexed image
Determines the minimal bit depth required for an indexed image
def determine_bit_depth
      case size
      when 1..2 then 1
      when 3..4 then 2
      when 5..16 then 4
      when 17..256 then 8
      end
    end
def determine_bit_depth case size when 1 .. 2 then 1 when 3 .. 4 then 2 when 5 .. 16 then 4 when 17 .. 256 then 8 end end
Determines the minimal bit depth required for an indexed image
Determines the minimal bit depth required for an indexed image
Number of bits per pixel, i.e. 1, 2, 4 or 8, or nil if this image cannot be saved as an indexed image.
Number of bits per pixel i . e . 1 2 4 or 8 or nil if this image cannot be saved as an indexed image .
Integer