ImageMagick can't use JPEG (OSX / X11)?

Trying to give RMagick a whirlwind using Mac OSX and homebrew.

Version: Mac OSX 10.7.5, HomeBrew 0.9.4., Ruby 2.0, Rmagick 2.13.2, ImageMagick 6.8.6-3.

Here is my Ruby code in a file called rename.rb :

 require 'RMagick' include Magick cat = ImageList.new("test.jpg") cat.display exit 

and here is my terminal output:

 rename.rb:5:in `display': delegate library support not built-in `test.jpg' (X11) @ error/display.c/DisplayImages/16067 (Magick::ImageMagickError) from rename.rb:5:in `<main>' 

It seems that I have the appropriate delegates installed (I'm not quite sure, however, since I'm n00b in ImageMagick). If I run convert -list configure , I get the following:

 ... DELEGATES bzlib fontconfig freetype jng jpeg png rsvg tiff xml zlib ... 

any ideas? Thanks!

+4
source share
1 answer

The image was read and processed successfully, your error is generated by cat.display . There is no image format delegate, but a window is displayed.

You will see the same error message on the command line if you simply type:

 display test.jpg 

So this is a problem with Image Magick, not RMagick or Ruby.

It seems that the display method is designed to work with the X11 window, which is not the default feature in Mac OS X. You might be able to restore it, including the X11 service and libary. I use XQuartz to support X11, but installing it after Image Magick (like me) will not solve this problem. So, I get the same error as you, but I do not use display , I just use the command like open test.jpg on the command line, or:

 `open test.jpg` 

from Ruby. This is not a platform agnostic solution, but I can perfectly view the images that I process.

Alternatively, you can try reinstalling Image Magick and rmagick with X11 support (assuming, of course, that you have an X11 service installed, such as XQuartz):

 brew unlink imagemagick brew install imagemagick --with-x11 gem install rmagick 

I tested this and it works so that cat.display will launch the display window. Although I think I will continue to use other viewers.

+11
source

Source: https://habr.com/ru/post/1496169/


All Articles