1

After a recent security update to ImageMagick on our Ubuntu server, we started encountering an issue with our Ruby code. We upgraded the ImageMagick package from version 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3 to 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.5. Post-upgrade, the following code began to fail:

require "rvg/rvg"

rvg = Magick::RVG.new(600, 600) do |canvas|
  canvas.background_fill = "white"
  bullets_graphic = ::Magick::Image.read(Rails.root.join("app/assets/images/score_5.png")).first
  canvas.image(bullets_graphic)
end

image = rvg.draw # failure points to this line
image.format = 'jpg'
image.to_blob do |img|
  img.quality = 90
  img.depth = 8
end

We receive the following error:

Magick::ImageMagickError: unable to open image 5335': No such file or directory @ error/blob.c/OpenBlob/2924 [GEM_ROOT]/gems/rmagick-5.5.0/lib/rvg/misc.rb:528:in draw'

The error references this line in the rmagick source code: rmagick/rvg/misc.rb#L528.

Note: If I do not do the canvas.image call, then it works.

Our environment details:

•   Ubuntu Version: 22.04
•   Ruby Version: 3.2.2
•   MiniMagick Version: 4.13.2
•   RMagick Version: 5.5.0

We have tried the following troubleshooting steps without success:

1.  Reinstalled/compiled RMagick

Has anyone else encountered a similar issue after an ImageMagick upgrade? Any suggestions on how to resolve this error would be greatly appreciated.

1
  • Based on a Google search, this error usually indicates a legitimate permission error. Either the input cannot be read or output cannot be written. Perhaps it is trying to write the data to a temporary file that it doesn't have permission to? Commented Aug 12, 2024 at 15:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.