Page 1 of 1

IM Cylinderize returns nothing.

Posted: 2009-09-03T19:49:02-07:00
by handellphp
I have ran many examples from the IM site and most of them work.
But the one I am interested in the most does not seem to function properly.
I copied the commands directly from the IM site for the cylinderize feature.

Can someone throw me a lifeline. Im drowning!

Code: Select all

<?php
$image="image-2.jpg";
$output = "cylinder.png";

 
       
 exec("convert  $image  -background black -gravity south -splice 0x8 \
          \( +clone -sparse-color barycentric '0,0 black 69,0 white' \) \
          \( +clone -function arcsin 0.5 \) \
          \( -clone 1 -level 25%,75% \
                 -function polynomial -4,4,0 -gamma 2 \
                 +level 50%,0 \) \
          -delete 1 -swap 0,1  miff:- |\
     composite - -virtual-pixel black  -displace 17x7  $output");
  
echo "<br><img src=\"". $output ."\"><br>";
 ?>

Re: IM Cylinderize returns nothing.

Posted: 2009-09-03T19:54:25-07:00
by fmw42
that is not the cylinderize script. looks more like the hourglass script. which do you want?

see

http://www.imagemagick.org/Usage/displace/#hourglass
http://www.imagemagick.org/Usage/displa ... e_cylinder

If you want the cylinderize script, just call my bash script, cylinderize, (from which this is a variation) from your exec command

If you want the hourglass script, this works fine for me using the rose: image and size 100x100 in command line.

convert -size 100x100 xc: -channel G \
-fx 'sc=.15; (i/w-.5)/(1+sc*cos(j*pi*2/h)-sc)+.5' \
-separate map_hourglass.png

convert rose: -matte -bordercolor none -border 1x0 map_hourglass.png \
-channel RGBA -fx 'p{ v.p{i*v.w/w,j*v.h/h}.g*w, j}' \
-shave 1x0 distort_hourglass2.png


What size is your input image? What does it look like? Try using Anthony's script first before changing the image and map size!

I am no PHP expert, but perhaps it is the unix line continuations. Try removing the \ continuations

Re: IM Cylinderize returns nothing.

Posted: 2009-09-03T19:59:17-07:00
by handellphp
I posted the wrong script. This is the one I'm having troule with.

Code: Select all

<?php
$image="image-2.jpg";
$output = "cylinder.png";

 
       
 exec("convert  $image  -background black -gravity south -splice 0x8 \
          \( +clone -sparse-color barycentric '0,0 black 69,0 white' \) \
          \( +clone -function arcsin 0.5 \) \
          \( -clone 1 -level 25%,75% \
                 -function polynomial -4,4,0 -gamma 2 \
                 +level 50%,0 \) \
          -delete 1 -swap 0,1  miff:- |\
     composite - -virtual-pixel black  -displace 17x7  $output");
  
echo "<br><img src=\"". $output ."\"><br>";
 ?>

Re: IM Cylinderize returns nothing.

Posted: 2009-09-03T20:04:25-07:00
by fmw42
convert rose: -background black -gravity south -splice 0x8 \
\( +clone -sparse-color barycentric '0,0 black 69,0 white' \) \
\( +clone -function arcsin 0.5 \) \
\( -clone 1 -level 25%,75% \
-function polynomial -4,4,0 -gamma 2 \
+level 50%,0 \) \
-delete 1 -swap 0,1 miff:- |\
composite - -virtual-pixel black -displace 17x7 rose_cylinder.png

works fine for me in command line. Have you tried using the rose image and reproducing the script exactly?

What version of IM are you using? Perhaps it is too old for some of the new features being used (-sparce-color, -funtion arcsin, -function polynomial)? Also try removing the line continuations and putting it all in one line. Also I don't know what you might have to do with quotes and the parenthesis processing in PHP. Hopefully Bonzo can help as he does a lot of PHP exec processing.

OH! and most important, you may need to provide the full path to convert (typically /usr/local/bin/convert) and possibly the full path to your images. See Bonzo's site at http://www.rubblewebs.co.uk/imagemagick/

what do you get from:

<?php
system("convert -version");
?>

or
<?php
system("/usr/local/bin/convert -version");
?>

Re: IM Cylinderize returns nothing.

Posted: 2009-09-03T20:26:22-07:00
by handellphp
FROM:
<?php
system("convert -version");
?>

I get:
"Version: ImageMagick 6.2.8 04/17/08 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC "


I ran the script exact and still got nothing.

Code: Select all

<?php
   
exec("convert rose: -background black -gravity south -splice 0x8 \
\( +clone -sparse-color barycentric '0,0 black 69,0 white' \) \
\( +clone -function arcsin 0.5 \) \
\( -clone 1 -level 25%,75% \
-function polynomial -4,4,0 -gamma 2 \
+level 50%,0 \) \
-delete 1 -swap 0,1 miff:- |\
composite - -virtual-pixel black -displace 17x7 rose_cylinder.png");
  

?>

Re: IM Cylinderize returns nothing.

Posted: 2009-09-03T20:58:02-07:00
by fmw42
Your version of IM (6.2.8 ) is way to old. (about 270 minor versions old). currently 6.5.5-6

-function was added 6.4.8-8
-sparse-color added 6.4.3-0

Looks like an upgrade is desperately needed for you.

Re: IM Cylinderize returns nothing.

Posted: 2009-09-03T21:11:34-07:00
by handellphp
Thanks, I will look into getting the new version installed on my server. I am currently using bluehost hosting to which IM was pre-installed.

Can IM be installed in my root directory anywhere?

Re: IM Cylinderize returns nothing.

Posted: 2009-09-03T21:34:16-07:00
by fmw42
I think so, but I do not know enough to inform you. You should discuss with your ISP. Also see

http://www.imagemagick.org/script/advan ... lation.php

Re: IM Cylinderize returns nothing.

Posted: 2009-09-03T21:47:31-07:00
by anthony
Their has been a number of installation discussions recently too.
Specifically about "personal" installations.

Re: IM Cylinderize returns nothing.

Posted: 2009-09-04T13:16:23-07:00
by handellphp
Are there any step by step instructions for this installation?
My server is limited to just SSh access.

I am wondering if I cant just use the IM app from
another server while saving the images to mine?

Re: IM Cylinderize returns nothing.

Posted: 2009-09-06T19:18:11-07:00
by anthony
To install a personal verion in the directory $HOME/apps/im
I do the following...

I download, and unpack the ImageMagick sources, and CD into that directory.
Then I use..

Code: Select all

  export MAGICK_HOME=$HOME/apps/im
  rm config.status config.log
  nice ./configure --prefix=$MAGICK_HOME --disable-installed \
          --enable-shared --disable-static --without-modules --with-x \
          --without-perl --without-magick-plus-plus --disable-openmp \
          --with-wmf --with-gslib --with-rsvg --with-xml \
          CFLAGS=-Wextra \
          ;
  nice make clean
  nice make
  nice make install
Now when I want to use IM from my personal area I set the following environment variables.

Code: Select all

export MAGICK_HOME=$HOME/apps/im
export PATH="$MAGICK_HOME/bin:$PATH"
export LD_LIBRARY_PATH="$MAGICK_HOME/lib:$LD_LIBRARY_PATH"

Re: IM Cylinderize returns nothing.

Posted: 2009-09-06T22:07:54-07:00
by handellphp
Thanks Anthony, this worked perfectly after installation. Thank you very much.

Re: IM Cylinderize returns nothing.

Posted: 2009-09-08T18:17:00-07:00
by anthony
I have added the above to IM examples, build/install notes
http://www.imagemagick.org/Usage/api/#personal

It should appear in a few hours.