jeudi 10 juin 2021

Create a image with MiniMagick::Image getting improper image header

I'm creating a png image with MiniMagick::Image and it giving me an false result when I checked with valid? function: there are 2 error composite: ImproperImageHeader and composite: MissingAnImageFilename

Here is my code:

img = MiniMagick::Image.new(Tempfile.new(['label_creation_date', '.png']).path)

MiniMagick::Image.new(Tempfile.new(['label_creation_date', '.png']).path).tap do |tmp_image|
  MiniMagick::Tool::Convert.new.tap do |convert|
    convert << tmp_image.path
    convert.background 'transparent'
    convert.rotate '-4'
    convert << tmp_image.path.to_s
  end
end

I tried one more solution that in gives in https://github.com/minimagick/minimagick/issues/59#issuecomment-3775000 here, but unfortunately it's also not working.

Please help me how can I create a valid image from scratch with the help of minimagick?

Thanks

Aucun commentaire:

Enregistrer un commentaire