Closed ggenzone closed 3 years ago
I found a problem with a GIF image, I know that prawn doesn't support GIF image but ,I am not sure if the problem is prawn-gmagick or prawn.
Source Image:
Example code:
require "prawn/gmagick" Prawn::Document.generate('example.pdf') do |pdf| pdf.image "example.gif" end
Output:
In this specific case prawn-gmagick read the image and create this object
def initialize image_blob self.gimage = GMagick::Image.new image_blob self.bits = gimage.depth self.width = gimage.width self.height = gimage.height end def build_pdf_object(document) obj = document.ref!( Type: :XObject, Subtype: :Image, ColorSpace: gimage.colorspace, # = DeviceRGB Height: height, # = 243 Width: width, # = 341 BitsPerComponent: bits # = 4 ) obj << gimage.unpack ...
The problem seems to be related to BitsPerComponent if I put 8 instead of the variable the image looks correct.
BitsPerComponent
https://github.com/packetmonkey/prawn-gmagick/blob/master/lib/prawn/gmagick.rb#L27
Does anyone know if the problem is using image.depth as BitPerComponet or if the problem is internal in prawn?
Thanks!
This is most certainly a bug in prawn-gmagick in that it doesn't correctly construct the needed PDF objects. I will close the issue here since you already have an issue in the prawn-gmagick repo.
prawn-gmagick
I found a problem with a GIF image, I know that prawn doesn't support GIF image but ,I am not sure if the problem is prawn-gmagick or prawn.
Source Image:
Example code:
Output:
In this specific case prawn-gmagick read the image and create this object
The problem seems to be related to
BitsPerComponent
if I put 8 instead of the variable the image looks correct.https://github.com/packetmonkey/prawn-gmagick/blob/master/lib/prawn/gmagick.rb#L27
Does anyone know if the problem is using image.depth as BitPerComponet or if the problem is internal in prawn?
Thanks!