message: Make 16bit ppm encoding actually work
  max_pixel_value() was overflowing u16 when doing it's calculations
  for 16bit values.
diff: @@ -76,11 +76,17 @@ impl<'a, W: Write> PPMEncoder<'a, W> {
  }
  fn max_pixel_value(pixel_type: color::ColorType) -> u16 {
  - match pixel_type {
  - Gray(n) => 2u16.pow(n as u32) - 1,
  - RGB(n) => 2u16.pow(n as u32) - 1,
  - Palette(n) => 2u16.pow(n as u32) - 1,
  - GrayA(n) => 2u16.pow(n as u32) - 1,
  - RGBA(n) => 2u16.pow(n as u32) - 1,
  + let max = match pixel_type {
  + Gray(n) => 2u32.pow(n as u32) - 1,
  + RGB(n) => 2u32.pow(n as u32) - 1,
  + Palette(n) => 2u32.pow(n as u32) - 1,
  + GrayA(n) => 2u32.pow(n as u32) - 1,
  + RGBA(n) => 2u32.pow(n as u32) - 1,
  + };
  +
  + if max > 65535 {
  + panic!("PPM: Trying to encode image with more than 16bit per pixel");
  + } else {
  + max as u16
  }
  }
  