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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ACIDSTEALTH
Posts: 4
Joined: 2016-04-27T09:05:30-07:00
Authentication code: 1151

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

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
ACIDSTEALTH
Posts: 4
Joined: 2016-04-27T09:05:30-07:00
Authentication code: 1151

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

Post 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.
Post Reply