How to convert an image into cylinderical image usng imagemagic?

A plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations.
Post Reply
solacedevelopers
Posts: 11
Joined: 2016-09-12T07:43:22-07:00
Authentication code: 1151

How to convert an image into cylinderical image usng imagemagic?

Post by solacedevelopers » 2016-11-26T05:51:10-07:00

HEllo guys,
I want to convert an image into cylindrical image. I tried the script from http://www.fmwconcepts.com/imagemagick/cylinderize/ and tried this command >> 'pyhysical_path_of_mydomain/cylinderize.sh' -m vertical -v background -b none -p 20 -t physical_path_of_mydomain/f4.jpg physical_path_of_mydomain/lamp_view/uploads/cyl_f2.jpg from server shell command it works for me, but not getting result when execute in php script. please help me and provide an example of command that you get cylindrical image from plain image.

snibgo
Posts: 9397
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to convert an image into cylinderical image usng imagemagic?

Post by snibgo » 2016-11-26T06:17:35-07:00

Code: Select all

exec("-m vertical -v background -b none -p 20 -t mydomainame/f4.jpg mydomainame/cylindrical_image.jpg 2>&1", $array)
If that is really your code, you need to include the script name.

If that wasn't your code, tell us what you really used.

What version of IM? On what platform? What error messages did you get?
snibgo's IM pages: im.snibgo.com

solacedevelopers
Posts: 11
Joined: 2016-09-12T07:43:22-07:00
Authentication code: 1151

Re: How to convert an image into cylinderical image usng imagemagic?

Post by solacedevelopers » 2016-11-26T06:38:45-07:00

Thank you for your reply and we are appreciate your reply.
I had used your mention command exec("-m vertical -v background -b none -p 20 -t mydomainame/f4.jpg mydomainame/cylindrical_image.jpg 2>&1", $array) and print the array. the array show empty and version of image magic is show in the bellow screenshot link >> http://prntscr.com/dc0hgy and When including script gives this error >>http://prntscr.com/dc0kwg

User avatar
fmw42
Posts: 22095
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: How to convert an image into cylinderical image usng imagemagic?

Post by fmw42 » 2016-11-26T10:45:45-07:00

If you are using my script, cylinderize, then you must include the script name in your exec command

exec("cylinderize -m vertical -v background -b none -p 20 -t mydomainame/f4.jpg mydomainame/cylindrical_image.jpg 2>&1", $array)

See my home page at the link below for usage of my scripts with PHP exec

solacedevelopers
Posts: 11
Joined: 2016-09-12T07:43:22-07:00
Authentication code: 1151

Re: How to convert an image into cylinderical image usng imagemagic?

Post by solacedevelopers » 2016-11-27T22:31:35-07:00

Thanks for the reply.
I used your command exec("cylinderize -m vertical -v background -b none -p 20 -t mydomainame/f4.jpg mydomainame/cylindrical_image.jpg 2>&1", $array) and it show me an error >> http://prntscr.com/dcn0jg

User avatar
fmw42
Posts: 22095
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: How to convert an image into cylinderical image usng imagemagic?

Post by fmw42 » 2016-11-27T22:43:23-07:00

Try duplicating one of my exact examples and see if it errors? Off hand I do not know what the issue might be.

What is your IM version and platform?

Did you follow all my instructions on my home page for using the script in a PHP exec command?

My guess is that you did not follow the instructions, especially about editing the script to tell it where IM convert exists or exporting the path to IM convert into your .profile file.

Did you also change the setting of dir to be dir="/tmp" rather than dir="."?

It is late for me tonight, but I think I see a potential oversight. The script may not be computing a default radius before it is needed. I will try looking in more detail tomorrow. But you can try adding -r radius. The radius must fit the half width of the object (coffee cup or whatever) or you must set it to some value. The default is 1/4 the size of the image. Try that and see if it works.

solacedevelopers
Posts: 11
Joined: 2016-09-12T07:43:22-07:00
Authentication code: 1151

Re: How to convert an image into cylinderical image usng imagemagic?

Post by solacedevelopers » 2016-11-27T23:02:49-07:00

Hello :)
this is my script
<?php

$cmd="/data/xhosts/mydomain.com/http/cylinderize -m vertical -v background -b none -p 20 -t /data/xhosts/mydomain.com/http/sample.jpg /data/xhosts/mydomain.com/http/cylinder.jpg 2>&1";
exec($cmd, $array);
echo "<pre>";print_r($array);
exit;

?>
which gives this error >> http://prnt.sc/dcn0jg

solacedevelopers
Posts: 11
Joined: 2016-09-12T07:43:22-07:00
Authentication code: 1151

Re: How to convert an image into cylinderical image usng imagemagic?

Post by solacedevelopers » 2016-11-27T23:23:18-07:00

Thanks for the suggestion "But you can try adding -r radius. ". it works for me. I just added radius in the above script and it works for me.
It is difficult to detect that the radius -r parameter is important in php script exec() , as it works in shell command properly without using -r paramter. THe script works for me after adding parameter -r >>
$cmd="/data/xhosts/mydomain.com/http/cylinderize -m vertical -r 400 -v background -b none -p 20 -t /data/xhosts/mydomain.com/http/sample.jpg /data/xhosts/mydomain.com/http/cylinder.jpg 2>&1";
exec($cmd, $array);
see screenshot >> http://prntscr.com/dcnd57
THANKS AGAIN :) :) :)

User avatar
fmw42
Posts: 22095
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: How to convert an image into cylinderical image usng imagemagic?

Post by fmw42 » 2016-11-28T01:16:48-07:00

I am not sure why it would work in a terminal without r and fails in PHP exec. But I will look again tomorrow at the code.

User avatar
fmw42
Posts: 22095
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: How to convert an image into cylinderical image usng imagemagic?

Post by fmw42 » 2016-11-28T10:55:13-07:00

I cannot make the script fail without -r. However, I switched some code around where I thought it should properly be located. So give the new version a try.

solacedevelopers
Posts: 11
Joined: 2016-09-12T07:43:22-07:00
Authentication code: 1151

Re: How to convert an image into cylinderical image usng imagemagic?

Post by solacedevelopers » 2016-12-06T07:32:54-07:00

Hello :)
My cylindrical image is ready. But the upper area of lamp is transparent and I want to fill the area by same image. Just like when we physically round an object . Just like this => http://prntscr.com/dg1s4l

User avatar
fmw42
Posts: 22095
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: How to convert an image into cylinderical image usng imagemagic?

Post by fmw42 » 2016-12-06T10:03:28-07:00

Sorry, my script won't currently do that.

Post Reply