Page 1 of 1

png:- works in shell. no encode delegate in proc_open

Posted: 2012-08-16T06:18:11-07:00
by CodeFan
Hello, installed ImageMagick-6.7.8-7 on CentOS 6 from source. However when I use convert to get me raw png output specifying png:- as output format raises a problem when it's being run using php's proc_open. Png output works only when the command is run from shell. Other formats work just fine with proc_open. An interesting fact is that the png format works when being saved into a file so:

Code: Select all

convert logo: logo.png
works fine when run with php's proc_open. Any ideas how i can fix that?

PS: Forgot to mention I've installed libpng from http://www.imagemagick.org/download/delegates/
Looks like the lack of shell environment causes the png output problem.

Some more details:
The exact error is:

Code: Select all

convert: no encode delegate for this image format 'png:-' @ error/constitute.c/WriteImage/1212.
The png:- format used to work for a couple of convert operations until it started giving this error. Running convert -list configure with both users returns the same:

Code: Select all

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

Name          Value
-------------------------------------------------------------------------------
CC            gcc -std=gnu99 -std=gnu99
CFLAGS        -fopenmp -g -O2 -Wall -pthread
CODER_PATH    /usr/local/lib/ImageMagick-6.7.8/modules-Q16/coders
CONFIGURE     ./configure
CONFIGURE_PATH /usr/local/etc/ImageMagick/
COPYRIGHT     Copyright (C) 1999-2012 ImageMagick Studio LLC
CPPFLAGS      -I/usr/local/include/ImageMagick
CXX           g++
CXXFLAGS      -g -O2 -pthread
DEFS          -DHAVE_CONFIG_H
DELEGATES     bzlib fontconfig freetype jpeg jng jp2 lcms png tiff x11 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-wmf=no --with-perl=no
DOCUMENTATION_PATH /usr/local/share/doc/ImageMagick-6.7.8
EXEC-PREFIX   /usr/local
EXECUTABLE_PATH /usr/local/bin
FEATURES      OpenMP
FILTER_PATH   /usr/local/lib/ImageMagick-6.7.8/modules-Q16/filters
HOST          x86_64-unknown-linux-gnu
INCLUDE_PATH  /usr/local/include/ImageMagick
LDFLAGS       -L/usr/local/lib -L/usr/lib
LIB_VERSION   0x678
LIB_VERSION_NUMBER 6,7,8,7
LIBRARY_PATH  /usr/local/lib/ImageMagick-6.7.8
LIBS          -lMagickCore -llcms -ltiff -lfreetype -ljasper -ljpeg -lpng15 -lfontconfig -lXext -lXt -lSM -lICE -lX11 -lbz2 -lxml2 -lz -lm -lgomp -lpthread -lltdl
NAME          ImageMagick
PCFLAGS       -fopenmp
PREFIX        /usr/local
QuantumDepth  16
RELEASE_DATE  2012-08-16
SHARE_PATH    /usr/local/share/ImageMagick-6.7.8
SVN_REVISION  8767
TARGET_CPU    x86_64
TARGET_OS     linux-gnu
TARGET_VENDOR unknown
VERSION       6.7.8
WEBSITE       http://www.imagemagick.org

Path: [built-in]

Name          Value
-------------------------------------------------------------------------------
NAME          ImageMagick
Below is a segment from consitute.c around line 1212 (in bold):

Code: Select all

          if ((magick_info == (const MagickInfo *) NULL) ||
              (GetImageEncoder(magick_info) == (EncodeImageHandler *) NULL))
            {
              magick_info=GetMagickInfo(image->magick,&image->exception);
              if ((magick_info == (const MagickInfo *) NULL) ||
                  (GetImageEncoder(magick_info) == (EncodeImageHandler *) NULL))
[b]                (void) ThrowMagickException(&image->exception,GetMagickModule(),[/b]
                  MissingDelegateError,"NoEncodeDelegateForThisImageFormat",
                  "'%s'",image->filename);
              else
                (void) ThrowMagickException(&image->exception,GetMagickModule(),
                  MissingDelegateWarning,"NoEncodeDelegateForThisImageFormat",
                  "'%s'",image->filename);
            }