kwaigon
kwaigon

Reputation: 815

Rails: ImageMagick "`identify -format" command fails in Rails

I'm using Rails with mini_magick and my code fails on call of image.size with such exception:

`identify -format %m %w %h %b /tmp/RackMultipart20231025-217-shzlwd.png[0]` failed with error:
  > image.size

Recently I updated my ruby version to 3.1 and Rails to 7.0, so it could be somehow connected with it. Also using mini_magick version 4.11.0.

Any hints how to fix this?

Upvotes: 0

Views: 91

Answers (1)

kwaigon
kwaigon

Reputation: 815

So, the issue really connected with ImageMagick (IM) version. My IM version was 6.9.10-23.

Old IM crashes on PNGs > 16000 width: https://github.com/ImageMagick/ImageMagick/issues/2732

Upgrade IM to version 6.9.11 can fix this issue (if you are using Heroku, migrate to heroku-22 will automatically update IM version).

PS: Resizing image can be as workaround, if there is no possibility to update IM itself.

Upvotes: 1

Related Questions