Page 1 of 2

How to convert an image into cylinderical image usng imagemagic?

Posted: 2016-11-26T05:51:10-07:00
by solacedevelopers
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.

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

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

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?

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

Posted: 2016-11-26T06:38:45-07:00
by solacedevelopers
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

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

Posted: 2016-11-26T10:45:45-07:00
by fmw42
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

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

Posted: 2016-11-27T22:31:35-07:00
by solacedevelopers
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

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

Posted: 2016-11-27T22:43:23-07:00
by fmw42
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.

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

Posted: 2016-11-27T23:02:49-07:00
by solacedevelopers
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

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

Posted: 2016-11-27T23:23:18-07:00
by solacedevelopers
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 :) :) :)

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

Posted: 2016-11-28T01:16:48-07:00
by fmw42
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.

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

Posted: 2016-11-28T10:55:13-07:00
by fmw42
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.

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

Posted: 2016-12-06T07:32:54-07:00
by solacedevelopers
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

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

Posted: 2016-12-06T10:03:28-07:00
by fmw42
Sorry, my script won't currently do that.

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

Posted: 2019-03-03T12:04:09-07:00
by imran_ullah
Hello When I run the cylinderize script it gives the error shown in the screenshot.

https://screenshot.net/4rwdet3

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

Posted: 2019-03-03T12:22:50-07:00
by fmw42
That does not tell me much and I have never seen that type of error. It appears that you are on a PC. My script does not work for normal Windows. It needs Windows 10 unix or Windows with Cygwin. Can you tell me what your IM version is and also what type of Unix system you are using. If on Windows Unix of some type. See my home page for instructions for using my scripts with Windows Unix at http://www.fmwconcepts.com/imagemagick/index.php. Also see the top most post on here in this forum viewtopic.php?f=26&t=25910

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

Posted: 2019-03-04T03:30:42-07:00
by imran_ullah
Hi I am not on PC with Windows I am on Ubuntu 16. My IM version is 6.8. The Screenshot shows the command line with command being run and the output is shown. The script aborts on line 933 not sure why.