Page 1 of 1

RMagick::Draw / ImageMagick::Draw Error: (no primitives defined)

Posted: 2016-04-27T09:14:28-07:00
by ACIDSTEALTH
I just installed ImageMagick 6.9.3 on OS X 10.11.4 using brew, along with the RMagick ruby gem so I can learn how to use it for a project. Following along with one of the examples in the RMagick docs (https://rmagick.github.io/usage.html#drawing_on), I call `circle = Magick::Draw.new`, which returns an error:

Code: Select all

(no primitives defined)
Can anyone give me an explanation of what this error means and how I can fix it? A friend of mine suggested that I may be missing one of the dependencies that ImageMagick uses for drawing, but I'm not sure how to dig any deeper than that. I'm not sure if this forum is the best place to ask this question since RMagick is jut a wrapper/interface for ImageMagick, but I've had very little success getting help elsewhere with this issue and would really like to be able to use ImageMagick in a ruby app I'm building for a project. Thanks!

In an IRB session, here are the exact steps I took:

Code: Select all

require 'RMagick'

canvas = Magick::ImageList.new
canvas.new_image(250, 250, Magick::HatchFill.new('white', 'gray90'))

circle = Magick::Draw.new

Re: RMagick::Draw / ImageMagick::Draw Error: (no primitives defined)

Posted: 2016-04-27T09:30:47-07:00
by snibgo
I know nothing about Ruby. But your code seems to say "draw something" without saying what you want to draw. You "circle" is merely a variable name, I think. If you want to draw a circle, you'll need to give the centre and radius, or whatever your interface needs.

Re: RMagick::Draw / ImageMagick::Draw Error: (no primitives defined)

Posted: 2016-04-27T13:34:58-07:00
by ACIDSTEALTH
It turns out that the message was not an error, but simply a way of telling me that I needed to add primitives to my circle object. I finally got it working and was able to create a simple graphic.