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.
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 »

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: 12159
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 »

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 »

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

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

Post 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
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 »

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

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

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

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 »

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

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

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

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

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

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

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

Post by fmw42 »

Sorry, my script won't currently do that.
imran_ullah
Posts: 3
Joined: 2019-03-03T03:46:13-07:00
Authentication code: 1152

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

Post by imran_ullah »

Hello When I run the cylinderize script it gives the error shown in the screenshot.

https://screenshot.net/4rwdet3
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
imran_ullah
Posts: 3
Joined: 2019-03-03T03:46:13-07:00
Authentication code: 1152

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

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