lib/prawn/images.rb in prawn-0.1.1 vs lib/prawn/images.rb in prawn-0.1.2

- old
+ new

@@ -143,26 +143,16 @@ if png.bits > 8 raise ArgumentError, 'PNG uses more than 8 bits' end - case png.color_type - when 0 - ncolor = 1 + case png.pixel_bytes + when 1 color = :DeviceGray - when 2 - ncolor = 3 - color = :DeviceRGB when 3 - ncolor = 1 - color = :DeviceRGB - when 6 - ncolor = 3 - color = :DeviceRGB - else - raise ArgumentError, "PNG has unsupported color type" - end + color = :DeviceRGB + end # build the image dict obj = ref(:Type => :XObject, :Subtype => :Image, :Height => png.height, @@ -173,10 +163,10 @@ ) unless png.alpha_channel obj.data[:DecodeParms] = {:Predictor => 15, - :Colors => ncolor, + :Colors => png.pixel_bytes, :Columns => png.width} end # append the actual image data to the object as a stream obj << png.img_data