imagemagick - convert: non-conforming drawing primitive definition `text' -


imagemagick provides following command example of how draw text on image:

convert -size 250x50 xc:none  -box white  -pointsize 20 -gravity center \       -draw 'text 0,0 "  '\''  \"  $  \\  " ' \       -trim +repage  text_special_sd.gif 

when run code, error:

convert: non-conforming drawing primitive definition `text' @ error/draw.c/drawimage/3192.

the command want run following, gives same error:

convert /tmp/tmpgrazky -fill none -stroke chartreuse -strokewidth 2 \ -draw "rectangle 221,155,256,191"  -pointsize 17 -fill chartreuse \ -draw "text 20%,20% 'score:0.84'" /users/rose/home/video-object-detection/data/imagenet/n07840804/annotated/lbzhyvh74w8_10000/10000_99.jpg 

the suggestions in so post did not fix problem.

i'm on mac. answers find on web recommend trying different combination of single , double quotes around statement after -draw, think i've tried 'em all.

here's output of convert -version:

version: imagemagick 6.8.9-7 q16 x86_64 2014-08-31 http://www.imagemagick.org copyright: copyright (c) 1999-2014 imagemagick studio llc features: dpc modules delegates: bzlib freetype jng jpeg ltdl lzma png xml zlib 

here's output of convert -list configure:

path: /usr/local/cellar/imagemagick/6.8.9-7/lib/imagemagick//config-q16/configure.xml  name           value ------------------------------------------------------------------------------- cc             clang cflags         -i/usr/local/cellar/freetype/2.5.3_1/include/freetype2 -g -o2 -wall -march=core2 -fexceptions -d_fortify_source=0 -d_thread_safe -pthread -dmagickcore_hdri_enable=0 -dmagickcore_quantum_depth=16 coder_path     /usr/local/cellar/imagemagick/6.8.9-7/lib/imagemagick/modules-q16/coders configure      ./configure  '--disable-osx-universal-binary' '--prefix=/usr/local/cellar/imagemagick/6.8.9-7' '--disable-dependency-tracking' '--enable-shared' '--disable-static' '--without-pango' '--with-modules' '--disable-openmp' '--without-gslib' '--without-perl' '--with-gs-font-dir=/usr/local/share/ghostscript/fonts' '--without-openjp2' '--without-x' '--with-freetype=yes' 'cc=clang' 'cxx=clang++' configure_path /usr/local/cellar/imagemagick/6.8.9-7/etc/imagemagick-6/ copyright      copyright (c) 1999-2014 imagemagick studio llc cppflags       -i/usr/local/cellar/imagemagick/6.8.9-7/include/imagemagick-6 cxx            clang++ cxxflags       -g -o2 -d_thread_safe -pthread defs           -dhave_config_h delegates      bzlib mpeg freetype jng jpeg lzma png xml zlib distcheck_config_flags 'cc=clang' 'cxx=clang++' --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-gslib=no --with-fontpath= --with-gs-font-dir=/usr/local/share/ghostscript/fonts --with-gvc=no --with-openjp2=no --with-pango=no --with-rsvg=no --with-wmf=no --with-perl=no documentation_path /usr/local/cellar/imagemagick/6.8.9-7/share/doc/imagemagick-6 exec-prefix    /usr/local/cellar/imagemagick/6.8.9-7 executable_path /usr/local/cellar/imagemagick/6.8.9-7/bin features       dpc modules filter_path    /usr/local/cellar/imagemagick/6.8.9-7/lib/imagemagick/modules-q16/filters host           x86_64-apple-darwin13.3.0 include_path   /usr/local/cellar/imagemagick/6.8.9-7/include/imagemagick-6 ldflags        -l/usr/local/cellar/imagemagick/6.8.9-7/lib -l/applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.9.sdk/usr/lib lib_version    0x689 lib_version_number 6,8,9,7 library_path   /usr/local/cellar/imagemagick/6.8.9-7/lib/imagemagick libs           -l/usr/local/cellar/freetype/2.5.3_1/lib -lfreetype -l/usr/local/cellar/xz/5.0.5/lib -llzma -lbz2 -lz -lltdl -lm name           imagemagick pcflags        -dmagickcore_hdri_enable=0 -dmagickcore_quantum_depth=16 prefix         /usr/local/cellar/imagemagick/6.8.9-7 quantumdepth   16 release_date   2014-08-31 share_path     /usr/local/cellar/imagemagick/6.8.9-7/share/imagemagick-6 sharearch_path /usr/local/cellar/imagemagick/6.8.9-7/lib/imagemagick/config-q16 svn_revision   16331 target_cpu     x86_64 target_os      darwin13.3.0 target_vendor  apple version        6.8.9 website        http://www.imagemagick.org  path: [built-in]  name           value ------------------------------------------------------------------------------- features name           imagemagick quantumdepth   16 

update

~   convert       \ >    -debug draw \ >    -size 50x50 xc:none -gravity center -draw 'text 0,0 "a b c" ' 1.png 

prints:

2014-12-06t14:52:40-08:00 0:00.150 0.010u 6.8.9 draw convert[39332]: draw.c/drawimage/1784/draw   begin draw-image 2014-12-06t14:52:40-08:00 0:00.160 0.010u 6.8.9 draw convert[39332]: draw.c/drawimage/3129/draw     text 0,0 "a b c" 2014-12-06t14:52:40-08:00 0:00.160 0.010u 6.8.9 draw convert[39332]: draw.c/drawprimitive/4221/draw     begin draw-primitive 2014-12-06t14:52:40-08:00 0:00.160 0.010u 6.8.9 draw convert[39332]: draw.c/drawprimitive/4223/draw       affine: 1 0 0 1 0 0 convert: unable read font `(null)' @ error/annotate.c/renderfreetype/1127. convert: unable read font `(null)' @ error/annotate.c/renderfreetype/1127. 2014-12-06t14:52:40-08:00 0:00.310 0.040u 6.8.9 draw convert[39332]: draw.c/drawprimitive/4639/draw     end draw-primitive 2014-12-06t14:52:40-08:00 0:00.310 0.040u 6.8.9 draw convert[39332]: draw.c/drawimage/3179/draw   end draw-image convert: non-conforming drawing primitive definition `text' @ error/draw.c/drawimage/3192. 

an interesting part of command:

convert -debug -size 50x50 xc:none -gravity center -draw 'text 0,0 "a b c" ' 1.png 

is this:

2014-12-06t14:57:36-08:00 0:00.100 0.030u 6.8.9 annotate convert[39441]: annotate.c/gettypemetrics/798/annotate   metrics: text: b c; width: 0; height: 0; ascent: 0; descent: 0; max advance: 0; bounds: 0,0  0,0; origin: 0,0; pixels per em: 0,0; underline position: 0; underline thickness: 0 2014-12-06t14:57:36-08:00 0:00.110 0.040u 6.8.9 exception convert[39441]: annotate.c/renderfreetype/1127/exception   unable read font `(null)' 2014-12-06t14:57:36-08:00 0:00.110 0.040u 6.8.9 annotate convert[39441]: annotate.c/renderpostscript/1649/annotate   font none; pointsize 12 

the end of output of command this:

2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 coder convert[39441]: png.c/writeonepngimage/11175/coder     wrote png image data 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 coder convert[39441]: png.c/writeonepngimage/11178/coder       width: 50 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 coder convert[39441]: png.c/writeonepngimage/11181/coder       height: 50 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 coder convert[39441]: png.c/writeonepngimage/11190/coder       png bit-depth written: 1 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 coder convert[39441]: png.c/writeonepngimage/11199/coder       png color-type written: 0 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 coder convert[39441]: png.c/writeonepngimage/11202/coder       png interlace method: 0 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 coder convert[39441]: png.c/writeonepngimage/11263/coder     setting text chunk 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 coder convert[39441]: png.c/writeonepngimage/11266/coder       keyword: 'date:create' 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 coder convert[39441]: png.c/writeonepngimage/11263/coder     setting text chunk 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 coder convert[39441]: png.c/writeonepngimage/11266/coder       keyword: 'date:modify' 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 coder convert[39441]: png.c/writeonepngimage/11282/coder     writing png end info 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 resource convert[39441]: resource.c/relinquishmagickresource/862/resource   memory: 50b/24.4kib/2gib 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 coder convert[39441]: png.c/writeonepngimage/11344/coder     exit writeonepngimage() 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 coder convert[39441]: png.c/writepngimage/12183/coder   exit writepngimage() 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 cache convert[39441]: cache.c/destroypixelcache/965/cache   destroy 1.png[0] 2014-12-06t14:57:36-08:00 0:00.170 0.060u 6.8.9 resource convert[39441]: resource.c/relinquishmagickresource/862/resource   memory: 25kb/0b/2gib convert: non-conforming drawing primitive definition `text' @ error/draw.c/drawimage/3192. 

this annotate command,

~  convert      \ >    -size 50x50 xc:none -gravity center -annotate +0+0 "a b c" 2.png 

gave output:

convert: unable read font `(null)' @ error/annotate.c/renderfreetype/1127. convert: unable read font `(null)' @ error/annotate.c/renderfreetype/1127. 

the png created 257 bytes, , it's 50x50 pixels, don't see letters. in preview, looks transparent.

to debug problem, i'd start first use more simple command:

 convert \    -size 50x50 xc:none -gravity center -draw 'text 0,0 "a b c" ' 1.png 

probably doesn't work either. add -verbose command:

 convert    \    -verbose \    -size 50x50 xc:none -gravity center -draw 'text 0,0 "a b c" ' 1.png 

maybe better clue goes wrong? if not, add -debug draw:

 convert       \    -debug draw \    -size 50x50 xc:none -gravity center -draw 'text 0,0 "a b c" ' 1.png 

inspect messages. there may many dozen of them. clue? if not, try -debug all:

 convert      \    -debug \    -size 50x50 xc:none -gravity center -draw 'text 0,0 "a b c" ' 1.png 

if not yield hints, there alternative image operator try in place of -draw: -annotate. here (almost) equivalent command:

 convert      \    -size 50x50 xc:none -gravity center -annotate +0+0 "a b c" 2.png 

does -annotate work?


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -