Using convert -annotate or -append label

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
ravensrest
Posts: 365
Joined: Fri 22 Feb 2008, 16:43
Location: Grants Pass, Oregon

Using convert -annotate or -append label

#1 Post by ravensrest »

Has anyone been able to add text to a picture using convert and the annotate or append label options? I cannot seem to make them work. I get an error whenever I use either that ImageMagick cannot find the requisite font:

Code: Select all

[~]> convert /data/P1070053.jpg -background Khaki label:'Faerie Dragon' -gravity Center -append /data/test.jpg
convert: /usr/lib/libxml2.so.2: no version information available (required by /usr/lib/libMagickCore.so.3)
CRIT: rangecheck in .setuserparams
Operand stack:
    --nostringval--  --nostringval--  --nostringval--
CRIT: rangecheck in .setuserparams
Operand stack:
    --nostringval--  --nostringval--  --nostringval--
convert: unable to read font `/usr/lib/ImageMagick-6.6.2/config//usr/share/ghostscript/fontsx/n019003l.pfb' @ error/annotate.c/RenderFreetype/1056.
convert: Postscript delegate failed `/tmp/magick-XX3zrwSq':  @ error/ps.c/ReadPSImage/779.
This and all the other variations of the command string that I've tried produce /data/test.jpg, but there are no labels or annotations on any of them.

Oops, forgot. Have tried this in Puppy431, Slacko53, Wary53 and Racy53.

Thanks for any help you can offer.
BS

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

Re: Using convert -annotate or -append label

#2 Post by rcrsn51 »

ravensrest wrote:/fontsx
Is that correct or a typo? Because the "fontsx" folder certainly doesn't exist.

BTW, mtPaint can add text to an image, although that might not solve your problem.

[Edit] Try this:

Locate the folder /usr/share/fonts/default/Type1

Copy it into the folder /usr/share/ghostscript.

Rename the new folder as "fontsx".

Run convert with a command like:

Code: Select all

convert infile -gravity South -background Plum -splice 0x18 -annotate +0+2 'Hello World' outfile

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#3 Post by npierce »

Another good catch, rcrsn51.

I just installed imagemagick-6.6.2-6-w5 from the Wary 5 official repository. It contains a configuration file, /usr/lib/ImageMagick-6.6.2/config/type-ghostscript.xml, with 34 references to that non-existent directory (/usr/share/ghostscript/fontsx/).

For me, using Racy 5.2.2, this worked:

Code: Select all

ln -s  /usr/share/ghostscript/fonts /usr/share/ghostscript/fontsx
Presumably correcting the configuration file would also work.

(And I see you've also added a solution to your post.)

Modifying ravensrest's command to use an existing file on Racy for a source, like so:

Code: Select all

convert /usr/share/pixmaps/smileys.png -background Khaki label:'Faerie Dragon' -gravity Center -append /tmp/test.jpg
produced this:
Attachments
test.jpg
(24.06 KiB) Downloaded 287 times

User avatar
ravensrest
Posts: 365
Joined: Fri 22 Feb 2008, 16:43
Location: Grants Pass, Oregon

#4 Post by ravensrest »

Thank you both.

No, that is not a typo. ImageMagick is looking for fontsfx. Using the symbolic link suggested by npierce worked just fine.

I am continually amazed at the power packed into the various linux commands we use so casually.

Thanks again.
BS

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#5 Post by rcrsn51 »

ravensrest wrote: ImageMagick is looking for fontsfx.
As a test, I compiled ImageMagick from source in Slacko and it still wanted fontsx.

Post Reply