rmagick: Ruby 2.6.0+ Error when creating image from PDF on macOS
Hi Guys,
When trying to convert a PDF to an image we are getting the following crash:
file_blob = open("#{Rails.root}/spec/services/pdf/assets/3860-001_original.pdf", "rb").read
image1 = Magick::Image::from_blob(file_blob) do
self.format = 'PDF'
self.density = 144
self.quality = 100
self.colorspace = Magick::RGBColorspace
end
Magick::ImageMagickError: FailedToExecuteCommand `'gs' -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r144x144' '-sOutputFile=/var/folders/gp/74j6yggx6rjf_hdbg2v7fjsw0000gn/T/magick-81244zcSY9rmgFD4G%d' '-f/var/folders/gp/74j6yggx6rjf_hdbg2v7fjsw0000gn/T/magick-81244QWjhSzMnzzFn' '-f/var/folders/gp/74j6yggx6rjf_hdbg2v7fjsw0000gn/T/magick-81244YeH8uSjx5tZt'' (-1) @ error/delegate.c/ExternalD
Have tried the exact same code on Ruby 2.3.1 and Ruby 2.5.5 and it works perfectly.
It seems like their is a compatibility issue with Ruby 2.6.2.
Any help would be greatly appreciated!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 21 (10 by maintainers)
Commits related to this issue
- Add workaround to pdf problem (#1072) Close #483 — committed to rmagick/rmagick by Watson1978 4 years ago
- Add workaround on FreeBSD that it isn't able to process PDF Related to https://github.com/rmagick/rmagick/issues/483 ``` $ rake ...... Failures: 1) Magick::Image#read issue #483 can read PDF fil... — committed to Watson1978/rmagick by Watson1978 4 years ago
- Add workaround on FreeBSD that it isn't able to process PDF Related to https://github.com/rmagick/rmagick/issues/483 ``` $ rake ...... Failures: 1) Magick::Image#read issue #483 can read PDF fil... — committed to Watson1978/rmagick by Watson1978 4 years ago
- Add workaround for FreeBSD that it isn't able to process PDF (#1203) Related to https://github.com/rmagick/rmagick/issues/483 ``` $ rake ...... Failures: 1) Magick::Image#read issue #483... — committed to rmagick/rmagick by Watson1978 4 years ago
Have looked in to this further. The same code runs in rails, but fails in rspec tests, rails console and irb, but only for Ruby 2.6.2
Steps to reproduce in irb:
Swap to Ruby 2.6.2