Conjure Script

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
JonnyRobbie
Posts: 5
Joined: 2015-07-28T09:50:53-07:00
Authentication code: 1151

Conjure Script

Post by JonnyRobbie »

I'm having some problems getting to work a conjure script work properly.

Code: Select all

$ cat con_script.msl 
<?xml version="1.0" encoding="UTF-8"?>
<image>
        <read filename="image.png" />
        <draw primitive="rectangle" stroke="#f00" fill="#0f0" x="10,20" y="30,40" />
        <draw primitive="text" fill="#00f" text="sample text" x="100" y="100" font="GohuFont" />
        <annotate text="lorem ipsumR" family="GohuFont" x="10" y="30" pointsize="6" antialias="false"/>
        <write filename="image.png" />
</image>
$ ls
con_script.msl  image.png
$ conjure con_script.msl
I have prepaded a 512x512 pure white image.png beforehand.
  1. The annotate command does render text, but the font is incorrect. It does not render it in GohuFont, but what I think is Nimbus Sans. It may entirely be possible that the font is not correctly configured, but GohuFont works as my terminal font as well as if I try to change it in Firefox, so I think it might be configured right.
  2. The draw command does not seem to work. Not even one of the both primitive types.
Honestly the examples here http://imagemagick.org/www/conjure.html seem to be somewhat insufficient for me. Do I hove some error in the script or in the conjure arguments?

Code: Select all

$ uname -roms && conjure -version && fc-match "GohuFont"                                                     
Linux 4.1.2-2-ARCH x86_64 GNU/Linux                                                                                                       
Version: ImageMagick 6.9.1-8 Q16 x86_64 2015-07-14 http://www.imagemagick.org                                                             
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC                                                                                 
License: http://www.imagemagick.org/script/license.php                                                                                    
Features: Cipher DPC HDRI Modules OpenCL OpenMP                                                                                           
Delegates (built-in): bzlib cairo fontconfig freetype gslib jng jp2 jpeg lcms lqr ltdl lzma pangocairo png ps rsvg tiff webp wmf x xml zlib                                                                                                                                         
                                                                                                                                          
gohufont-11.pcf.gz: "GohuFont" "Regular"
Image
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Conjure Script

Post by magick »

We can reproduce the problem you reported, give us a day or two to investigate and get back with you.
JonnyRobbie
Posts: 5
Joined: 2015-07-28T09:50:53-07:00
Authentication code: 1151

Re: Conjure Script

Post by JonnyRobbie »

magick wrote:We can reproduce the problem you reported, give us a day or two to investigate and get back with you.
Do you mean the font issue, or even the draw issue? Thanks for looking into it.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Conjure Script

Post by magick »

Try this for a rectangle:
  • <draw primitive="rectangle" stroke="yellow" fill="cyan" points="10,20 60,40" />
Type
  • convert -list font
Is GohuFont listed as a font? ImageMagick defaults to Arial if it can't find the font you specify.

The documentation need improving of course. Conjure is supported and we do fix issues as they arise.
JonnyRobbie
Posts: 5
Joined: 2015-07-28T09:50:53-07:00
Authentication code: 1151

Re: Conjure Script

Post by JonnyRobbie »

Gohu is indeed not listed

Code: Select all

$ convert -list font | grep Gohu
returns nothing.

Your suggested draw methid works, thank you. I have an additional question though. The draw primitive text works only if the text is part of the primitive attrubute, but it does not work if it's a part of text attribute.

Code: Select all

<draw primitive="text 80,90 'lorem ipsumRR'" fill="#00f" family="GohuFont" pointsize="6" antialias="false"/> works (wrong font though), but
<draw primitive="text 80,90" text="lorem ipsumRR" fill="#00f" family="GohuFont" pointsize="6" antialias="false"/> does not
Why is that?
JonnyRobbie
Posts: 5
Joined: 2015-07-28T09:50:53-07:00
Authentication code: 1151

Re: Conjure Script

Post by JonnyRobbie »

Ok, thank you very much.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Conjure Script

Post by magick »

With the 6.9.2-0 patch available tomorrow, this will work:
  • <draw primitive="text" points="100,100" fill="blue" stroke="black" text="sample text" font="GohuFont" />
JonnyRobbie
Posts: 5
Joined: 2015-07-28T09:50:53-07:00
Authentication code: 1151

Re: Conjure Script

Post by JonnyRobbie »

just one more question. Will it be a general font fix or just Gohu fix? Because I have the same problem with another font:

Code: Select all

$ convert -list font | grep "Clean"                                                                        
$ fc-match "Clean"                                                                          
clR6x12-ISO8859-1.pcf.gz: "Clean" "Regular"
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Conjure Script

Post by magick »

See http://www.imagemagick.org/Usage/ near the bottom of the page under Font Usage. There is a script that finds all the fonts on your system and makes them available to ImageMagick.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Conjure Script

Post by fmw42 »

Post Reply