IM Cylinderize returns nothing.

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
handellphp

IM Cylinderize returns nothing.

Post 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>";
 ?>
Last edited by handellphp on 2009-09-03T19:59:35-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: IM Cylinderize returns nothing.

Post 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
Last edited by fmw42 on 2009-09-03T20:00:28-07:00, edited 2 times in total.
handellphp

Re: IM Cylinderize returns nothing.

Post 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>";
 ?>
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: IM Cylinderize returns nothing.

Post 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");
?>
handellphp

Re: IM Cylinderize returns nothing.

Post 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");
  

?>
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: IM Cylinderize returns nothing.

Post 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.
handellphp

Re: IM Cylinderize returns nothing.

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: IM Cylinderize returns nothing.

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: IM Cylinderize returns nothing.

Post by anthony »

Their has been a number of installation discussions recently too.
Specifically about "personal" installations.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
handellphp

Re: IM Cylinderize returns nothing.

Post 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?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: IM Cylinderize returns nothing.

Post 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"
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
handellphp

Re: IM Cylinderize returns nothing.

Post by handellphp »

Thanks Anthony, this worked perfectly after installation. Thank you very much.
Last edited by handellphp on 2009-09-08T18:54:11-07:00, edited 1 time in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: IM Cylinderize returns nothing.

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply