Page 1 of 1

imagemagick behaving very weird

Posted: 2011-03-18T02:34:25-07:00
by javismiles
dear friends,
im quite desperate here, lets see, i installed imagemagick on linux centos, all seemed great,
basic commands from PHP worked great,
but then i started to see that certain options would give errors like:
"missing an image filename" error,
which other people have reported in google,
and simple commands that would work in windows from PHP wouldnt in linux,
although others would, very confusing

so considering these problems i have
i start to consider if maybe my linux imagemagick installation although it seemed to work great, maybe its not correctly built and some things are missing?
what do u think? how do i know? how do i check?

i mean all seems to run great, i can convert a jpeg to a png and resize it no problems,
but then i do other simple things like a -fill option and i get the "missing an image filename" error,
when these things would never give a single problem in windows

why is using imagemagick in centos in linux so complicated?

how can i verify that my imagemagick installation has everything that is needed and that is not corrupted or damaged somehow?

doing an identify -version i get this:
Version: ImageMagick 6.6.8-5 2011-03-18 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP

Operating system is CentOS 5.5 64bits

dont know, im desperate, as i need to transport my windows site to this new linux server and never thought this would be such a nightmare,

simple commands work from php, yes i can convert a jpeg to a png and resize it for example,
but most other things fail, i cannot create a simple png from zero with a fill and a text,
i get either no errors or the - "missing an image filename" - error

does this mean my installed imagemagick is corrupted? what should i do?

thank you very much for your help
jav

Re: imagemagick behaving very weird

Posted: 2011-03-18T02:36:29-07:00
by javismiles
this is the result of the convert -list configure


convert -list configure

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

Name Value
-------------------------------------------------------------------------------
CC gcc -std=gnu99 -std=gnu99
CFLAGS -fopenmp -g -O2 -Wall -pthread
CONFIGURE ./configure '--prefix=/usr/local' '--with-bzlib=yes' '--with-fontconfig=yes' '--with-freetype=yes' '--with-gslib=yes' '--with-gvc=yes' '--with-jpeg=yes' '--with-jp2=yes' '--with-png=yes' '--with-tiff=yes'
COPYRIGHT Copyright (C) 1999-2011 ImageMagick Studio LLC
CPPFLAGS -I/usr/local/include/ImageMagick
CXX g++
CXXFLAGS -pthread
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib freetype gs jpeg jng lcms png tiff x11 zlib
DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-fontpath= --with-perl=no
EXEC-PREFIX /usr/local
FEATURES OpenMP
HOST x86_64-unknown-linux-gnu
LDFLAGS -L/usr/local/lib
LIB_VERSION 0x668
LIB_VERSION_NUMBER 6,6,8,5
LIBS -lMagickCore -llcms -ltiff -lfreetype -ljpeg -lgs -lpng -lXext -lXt -lSM -lICE -lX11 -lbz2 -lz -lm -lgomp -lpthread
NAME ImageMagick
PCFLAGS -fopenmp
PREFIX /usr/local
QuantumDepth 16
RELEASE_DATE 2011-03-18
VERSION 6.6.8
WEBSITE http://www.imagemagick.org

Re: imagemagick behaving very weird

Posted: 2011-03-18T05:36:55-07:00
by anthony
javismiles wrote:why is using imagemagick in centos in linux so complicated?
It shouldn't be. ImageMagick is available from the CentOS yum repositories! Perhaps the from teh rpmfusion repository.

However this is generally quite old, especially for CentOS 5. Whcih is why people generally build their own.

The best idea however is to at least insteall temporarilly the imagemagick-devel RPM fro ma YUM repositoiry, so it will install all the extra development packages as dependancies. You can also modify the 'Spec' Source RPM file to remove some of the dependencies too.

Re: imagemagick behaving very weird

Posted: 2011-03-18T14:25:05-07:00
by javismiles
thank you Anthony
like always im grateful for your help

i already did that, before rebuilding imagemagick i did a Yum for the development environment
so thats done, and image magick did build and install , its all there, its working,
the problems i have are that things that work from the shell and worked from php in windows, work from the shell in linux
but not from php, some do , some dont, so accessing via php is working indeed but some simple commands do not work from php

see this command

$cmd = "convert -background none -fill red -pointsize 51 label:TEST {$target_image}";

how can this possibly not work from php,
it works from shell
why wouldnt it work from php?

i see no parameter anywhere that could interfere with the lynux shell what do u think?

to demonstrate that php is working with imagemagick, this command does work
$cmd = "convert {$source_image} {$target_image}";
that works

but when i dont put a source image, it never works
like
$cmd = "convert -background none -fill red -pointsize 51 label:TEST {$target_image}";

why is this, is it getting confused with the paths?
i dont get it


thank u so much
jav

Re: imagemagick behaving very weird

Posted: 2011-03-18T14:33:04-07:00
by fmw42
$cmd = "convert -background none -fill red -pointsize 51 label:TEST {$target_image}";

how can this possibly not work from php,
try

$cmd = "convert -size 500x -font pathtoyourfont/fontname.ttf -background none -fill red -pointsize 51 label:'TEST' {$target_image}";


Also your delegates do not include fontconfig which is used to read the type.xml file that contains the font names so that the full path is not needed. And then you need to run Anthony's script, imagick_type_gen.pl, and replace the original type.xml with the new one created by the script.

see his scripts at http://www.imagemagick.org/Usage/scripts/

Re: imagemagick behaving very weird

Posted: 2011-03-18T14:37:53-07:00
by javismiles
i always use a font size etc, all of it
i just shortened the url to show a simplified example
but i always use font/fontfile etc etc
i was just showing the simplest case of what doesnt work

i dont understand what delegates are and that xml file, could you explain? i come from a windows background (unfortunately)
thank u very much

Re: imagemagick behaving very weird

Posted: 2011-03-18T14:42:58-07:00
by javismiles
by delegate you mean libraries missing?
if that one is missing how can i add that one?

and the imagick_type_gen.pl..
i am in linux how can i read that file?
is that really necessary? i only use fonts that i have myself in my path, i dont use system fonts

Re: imagemagick behaving very weird

Posted: 2011-03-18T14:44:31-07:00
by fmw42
IM relies upon standard support code for handling different image formats and other things, such as jpg, tiff, png image formats and ghostscript for handling PDFs. These code packages are called delegate libraries. When you install from binary or some RPM packages or windows packages, many of these are installed automatically. Others are optional and need to be installed before installing IM. When you install from source directly without some RPM or packages, then you have to manually install any delegates that you need to use to the same location that you are going to install IM or at least to some location that is in your PATH environment variable so IM can find it. Then install IM so that it can find them. Then when you do

convert -list configure

The line starting with DELEGATES, tells you which of these libraries IM knows about.

You can find older delegates at: http://www.imagemagick.org/download/delegates/, but I suggest locating them online to get current ones.

Re: imagemagick behaving very weird

Posted: 2011-03-18T15:05:59-07:00
by javismiles
thank you very much im going to check

im improving the situation
but i have this problem
i use different types of fonts, i have TTF and PFB
i see the TTF work, they work
but the PFB which work in windows, those font files dont work in linux
how can i make PFB work on linux?

Re: imagemagick behaving very weird

Posted: 2011-03-18T15:11:44-07:00
by fmw42
sorry I don't know enough about them. But look in Anthony's script. I believe he lists the font types that should work on unix.

It may be an issue of either freetype or fontconfig. But I am not an expert on either. Right now I am having trouble with getting fontconfig installed and working on my Mac.