imagick help

Discussion in 'PHP' started by stephan2307, Nov 11, 2011.

  1. #1
    I want to convert an image to a kinda cartoon like look.

    I have this piece of code

    
    <?php
    header("Content-type: image/jpeg");
    $image = new Imagick("opossum.jpg"); 
    $image->embossImage( 0, 1 );
    echo $image;
    ?> 
    
    PHP:
    Now I know the arguments I need which are

    -m 1 -d 10 -c soft_light
    Code (markup):
    But I am not sure how to use them.

    Can anyone help?

    I have the feeling that I might have to use exec rather then the php function but I am not sure.
     
    stephan2307, Nov 11, 2011 IP
  2. rainborick

    rainborick Well-Known Member

    Messages:
    424
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    120
    #2
    I know a little about ImageMagick, but I don't recognize the argument string you posted. What are you trying to do after embossImage()?
     
    rainborick, Nov 11, 2011 IP
  3. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #3
    stephan2307, Nov 11, 2011 IP
  4. rainborick

    rainborick Well-Known Member

    Messages:
    424
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    120
    #4
    I'm too busy just now, but I'll play with it later. In the meantime, you could try passing the arguments with
    
    $image->embossImage( 0, 1, '-m 1 -d 10 -c soft_light' );
    
    PHP:
    just to see how the interface reacts. Otherwise, you're probably going to have to rely on using an ImageMagick command with passthru();.
     
    rainborick, Nov 11, 2011 IP
  5. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #5
    I tried the above and it didn't work. thanks for suggesting though.
     
    stephan2307, Nov 11, 2011 IP
  6. rainborick

    rainborick Well-Known Member

    Messages:
    424
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    120
    #6
    OK. I didn't notice this before, but the example page you reference above is a Bash script and the arguments are unique to that script, which is why nothing happens with Imagick. So you'd have to install the script on your system and call it with passthru() to use the command as shown. You could also trace the script's internal functions and replicate them with Imagick commands, which may be the most practical approach. The script isn't terribly complicated, and you should be able to follow the logic even if you haven't worked with Bash scripts before. Finally, you could try to find other ImageMagick tutorials or examples that show similar effects. Sorry I couldn't be of more help. Good luck!
     
    rainborick, Nov 11, 2011 IP
  7. rainborick

    rainborick Well-Known Member

    Messages:
    424
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    120
    #7
    p.s. Fred includes instructions on using his scripts with PHP on the main page of his scripts.
     
    rainborick, Nov 12, 2011 IP