0

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?

6
  • I imagine you'd need to double-quote the format specification .... -format "%m %w %h %b" ... Commented Oct 25, 2023 at 13:07
  • Also, if using v7 ImageMagick, the syntax has changed and you need to use magick identify .... See stackoverflow.com/a/61208844/2836621 Commented Oct 25, 2023 at 13:23
  • 1
    Is your MiniMagick trying to use IM 7 and you only have IM 6 installed (or vice-versa)? Commented Oct 25, 2023 at 14:07
  • @MarkSetchell identify -format "%m %w %h %b" it's not my code - it's just error message from trace (seems like ImageMagick code). Commented Oct 25, 2023 at 14:23
  • 1
    Thank you for help guys, it was connected with ImageMagick version. Commented Oct 30, 2023 at 13:01

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for writing up the solution and sharing it back with the SO community.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.