Generate Image from Pango Markup Text

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
larryzhao
Posts: 3
Joined: 2012-11-05T01:50:39-07:00
Authentication code: 67789

Generate Image from Pango Markup Text

Post by larryzhao »

Dear guys,

I am an amateur to ImageMagick, please forgive me if this is a rookie mistake.

I am now working on using IM to generate formated text to an image, and after reading the IM docs, I think using Pango Markup could be the suitable solution to it. (Tell me if there's a better way for it.)

I installed Pango and IM with HomeBrew(I am on OSX Mountain Lion), and tried the basic sample command from: http://www.imagemagick.org/Usage/text/#pango

Code: Select all

convert -background lightblue pango:"Anthony Thyssen" pango.gif
I got:

Code: Select all

convert -background lightblue pango:"Anthony Thyssen" pango.gif
convert: unable to open image `Anthony Thyssen': No such file or directory @ error/blob.c/OpenBlob/2617.
convert: no decode delegate for this image format `Anthony Thyssen' @ error/constitute.c/ReadImage/544.
convert: no images defined `pango.gif' @ error/convert.c/ConvertImageCommand/3032.
And I get

Code: Select all

PANGO* PANGO     ---   Pango Markup Language
if I run

Code: Select all

convert -list format
How could I fix this error? Need your help.

Thanks a lot.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Generate Image from Pango Markup Text

Post by fmw42 »

I am not an expert but I think
PANGO* PANGO --- Pango Markup Language
the --- means that it is not installed properly as it is not even readable, let alone writable.
larryzhao
Posts: 3
Joined: 2012-11-05T01:50:39-07:00
Authentication code: 67789

Re: Generate Image from Pango Markup Text

Post by larryzhao »

fmw42 wrote:I am not an expert but I think
PANGO* PANGO --- Pango Markup Language
the --- means that it is not installed properly as it is not even readable, let alone writable.

@fmw42, I think you are correct, how could I fix this? Do I need to set some specific options when installing ImageMagic?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Generate Image from Pango Markup Text

Post by fmw42 »

@fmw42, I think you are correct, how could I fix this? Do I need to set some specific options when installing ImageMagic?
larryzhao


If you have installed PANGO properly and it does not show. Then try reinstalling IM adding --with-pango to your ./configure command. However, it should have enabled it automatically last I recall if Pango was installed properly. But adding --with-pango will not hurt to be sure that is not the issue.
larryzhao
Posts: 3
Joined: 2012-11-05T01:50:39-07:00
Authentication code: 67789

Re: Generate Image from Pango Markup Text

Post by larryzhao »

fmw42 wrote:
@fmw42, I think you are correct, how could I fix this? Do I need to set some specific options when installing ImageMagic?
larryzhao


If you have installed PANGO properly and it does not show. Then try reinstalling IM adding --with-pango to your ./configure command. However, it should have enabled it automatically last I recall if Pango was installed properly. But adding --with-pango will not hurt to be sure that is not the issue.
@fmw42, I tried compiling on my IM using --with-pango on my Mac, after the confirgure process, I get the following result:

Code: Select all

Delegate Configuration:
BZLIB             --with-bzlib=yes		yes
Autotrace         --with-autotrace=no		no
Dejavu fonts      --with-dejavu-font-dir=default	none
DJVU              --with-djvu=yes		no
DPS               --with-dps=yes		no
FFTW              --with-fftw=yes		no
FlashPIX          --with-fpx=yes		no
FontConfig        --with-fontconfig=yes		yes
FreeType          --with-freetype=yes		yes
GhostPCL          None				pcl6 (unknown)
GhostXPS          None				gxps (unknown)
Ghostscript       None				gs (9.06)
Ghostscript fonts --with-gs-font-dir=default	/opt/local/share/ghostscript/fontsx/
Ghostscript lib   --with-gslib=no		no
Graphviz          --with-gvc=no		
JBIG              --with-jbig=yes		no
JPEG v1           --with-jpeg=yes		yes
JPEG-2000         --with-jp2=yes		no
LCMS v1           --with-lcms=no		no
LCMS v2           --with-lcms2=yes		yes
LQR               --with-lqr=yes		no
LTDL              --with-ltdl=yes		no
LZMA              --with-lzma=yes		yes
Magick++          --with-magick-plus-plus=yes	yes
OpenEXR           --with-openexr=yes		no
PERL              --with-perl=no		no
PANGO             --with-pango=yes		no
PNG               --with-png=yes		yes
RSVG              --with-rsvg=no		no
TIFF              --with-tiff=yes		yes
WEBP              --with-webp=yes		yes
Windows fonts     --with-windows-font-dir=	none
WMF               --with-wmf=no			no
X11               --with-x=			yes
XML               --with-xml=yes		yes
ZLIB              --with-zlib=yes		yes
--with-pango is included with `=yes`, but the last column is `no`.

After install, the result of `convert -list format` is still the same:

Code: Select all

PANGO* ---   Pango Markup Language
I think my pango is correctly installed, since I could get correct preview of Pango markup text with pango-view command.

What's wrong with it?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Generate Image from Pango Markup Text

Post by fmw42 »

It would seem that Pango is not installed properly or most likely not where IM can find it.

(Check your Pango install and see if there are any errors. Perhaps some other delegate is needed before installing Pango.)

How did you install Pango and your other delegates such as tiff, png, jpg? Did you use MacPorts? How did you install IM? From binary or source? Did you use MacPorts?

What version of Pango did you install? What version of IM?

Type the following

convert -list configure

What DELEGATES do you have installed that IM recognizes? I am not sure if Pango will show or not. Just want to be sure you do have minimum delegates.

Where is IM and where is Pango located on your system?

type -a convert

On my system it is at:
convert is /usr/local/bin/convert


find /usr | grep "pango"

or if installed by MacPorts

find /opt | grep "pango"
imageMaster
Posts: 2
Joined: 2014-04-24T09:19:07-07:00
Authentication code: 6789

Re: Generate Image from Pango Markup Text

Post by imageMaster »

I've run on the same issue.
OS: MAC OS X 10.9.2
ImageMagick: 6.8.9-0

I've builded and installed ImageMagick from sources.
When i run './configure' it outputs

Code: Select all

PANGO             --with-pango=yes		yes
'convert -list configure'

Code: Select all

Path: /usr/local/lib/ImageMagick-6.8.9//config-Q16/configure.xml

Name           Value
-------------------------------------------------------------------------------
CC             gcc
CFLAGS         -I/usr/local/Cellar/freetype/2.5.3_1/include/freetype2 -g -O2 -Wall -fexceptions -D_FORTIFY_SOURCE=0 -D_THREAD_SAFE -pthread -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
CODER_PATH     /usr/local/lib/ImageMagick-6.8.9/modules-Q16/coders
CONFIGURE      ./configure  '--with-pango'
CONFIGURE_PATH /usr/local/etc/ImageMagick-6/
COPYRIGHT      Copyright (C) 1999-2014 ImageMagick Studio LLC
CPPFLAGS       -I/usr/local/include/ImageMagick-6
CXX            g++
CXXFLAGS       -g -O2 -D_THREAD_SAFE -pthread
DEFS           -DHAVE_CONFIG_H
DELEGATES      bzlib mpeg fontconfig freetype jng jpeg pango png x xml zlib
DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-gslib=no --with-fontpath= --with-gvc=no --with-rsvg=no --with-wmf=no --with-perl=no
DOCUMENTATION_PATH /usr/local/share/doc/ImageMagick-6
EXEC-PREFIX    /usr/local
EXECUTABLE_PATH /usr/local/bin
FEATURES       DPC
FILTER_PATH    /usr/local/lib/ImageMagick-6.8.9/modules-Q16/filters
HOST           x86_64-apple-darwin13.1.0
INCLUDE_PATH   /usr/local/include/ImageMagick-6
LDFLAGS        -L/usr/local/lib -L/usr/X11/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,0
LIBRARY_PATH   /usr/local/lib/ImageMagick-6.8.9
LIBS           -L/usr/local/Cellar/freetype/2.5.3_1/lib -lfreetype -ljpeg -lpng15 -L/usr/local/Cellar/fontconfig/2.11.1/lib -L/usr/local/Cellar/freetype/2.5.3_1/lib -lfontconfig -lfreetype -lXext -lXt -lSM -lICE -lX11 -lbz2 -L/usr/local/Cellar/pango/1.36.3/lib -L/usr/local/Cellar/glib/2.40.0/lib -L/usr/local/opt/gettext/lib -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lxml2 -lz -lm
NAME           ImageMagick
PCFLAGS        -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
PREFIX         /usr/local
QuantumDepth   16
RELEASE_DATE   2014-04-24
SHARE_PATH     /usr/local/share/ImageMagick-6
SHAREARCH_PATH /usr/local/lib/ImageMagick-6.8.9/config-Q16
SVN_REVISION   15442
TARGET_CPU     x86_64
TARGET_OS      darwin13.1.0
TARGET_VENDOR  apple
VERSION        6.8.9
WEBSITE        http://www.imagemagick.org

Path: [built-in]

Name           Value
-------------------------------------------------------------------------------
FEATURES       
NAME           ImageMagick
QuantumDepth   16
But 'convert -list format' outputs:

Code: Select all

PANGO* ---   Pango Markup Language
Can someone help me to resolve this issue?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Generate Image from Pango Markup Text

Post by fmw42 »

Be sure you have installed the latest version of Pango and recompile IM afterwards. It may be that the version you have is incompatible. You could also try adding --with-pango to your ./configure command. If it fails, look at the config.log file to see what the issue is for the error. Pango may need other support libraries itself.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Generate Image from Pango Markup Text

Post by anthony »

If compiling ImageMagick to add pango, you not only need pango, but the pango devlopment package. That is the header files that define the pango library interface. This are often not included in the normal package as it is only needed when compiling new programs to use the library, and packages typically already have that done.

However as 'pango' is listed, it was probably already compiled into imagemagick, in which can it just needs to find the pango dynamic libraries, without needing the development headers. It would then just need to knwo where the libraries are at run time.

I am not certain about this aspect with MacOSX as I do nt use that OS, but the default package installed version of IM on my Fedora system worked with pango out of the box, but then pango is part ofgnome 3 which is standard on fedora systems. again not moh help specifically for MacOSX.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
hkits
Posts: 1
Joined: 2014-09-13T05:00:28-07:00
Authentication code: 6789

Re: Generate Image from Pango Markup Text

Post by hkits »

On Ubuntu I had the same problem when I add a space after pango: and before the text.

like this: pango: "xxxxxx"

That extra space caused the problem on my end.
mebibou
Posts: 1
Joined: 2014-09-14T08:06:27-07:00
Authentication code: 6789

Re: Generate Image from Pango Markup Text

Post by mebibou »

I've installed pango with brew:

Code: Select all

brew install pango
Then installed imagemagick from brew:

Code: Select all

brew install imagemagick
'convert -list format' outputs:

Code: Select all

PANGO* ---   Pango Markup Language
So then I tried to edit the imagemagick formula to force including of pango, since by default during ./configure it does not include pango:

Code: Select all

brew edit imagemagick
// replace --without-pango by --with-pango
Then I uninstalled imagemagick and re-install doing:

Code: Select all

brew uninstall imagemagick
brew install imagemagick -v --build-from-source
during install, configure looks like

Code: Select all

./configure --disable-osx-universal-binary --prefix=/usr/local/Cellar/imagemagick/6.8.9-5 --disable-dependency-tracking --enable-shared --disable-static --with-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
'convert -list format' still outputs:

Code: Select all

PANGO* ---   Pango Markup Language
How do I install imagemagick with pango support using brew?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Generate Image from Pango Markup Text

Post by anthony »

--- means while the module is present, it has no read or write (thrid is multi-image support)! No flags at all!

its sort of a three strikes and out!

Sorry. The module may be present but it is not finiding what it needs to initialise.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Generate Image from Pango Markup Text

Post by fmw42 »

./configure --disable-osx-universal-binary --prefix=/usr/local/Cellar/imagemagick/6.8.9-5 --disable-dependency-tracking --enable-shared --disable-static --with-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
I do not believe that =yes is acceptable format. just leave it off as --with-freetype. However, I am not sure this will cause you problems with pango. Pango must be installed where IM can find it.

Perhaps your Pango installation had problems. Or perhaps you do not have a current enough Pango?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Generate Image from Pango Markup Text

Post by anthony »

As the 'coder' module was built, it must have found the header files and library when it was built, But as it is not initialising at run time, it is not finding the pango library the coder needs on the run time library path.

It may be your LD_LIBRARY_PATH (or equivelent) is nto set right, or the pango library is different (or differnt location) to when the coder was built.

There are a number of thing that could be wrong, especialy if the system or actual machine is different to when the the coder was built.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply