I'm writing a web-app in PHP that will take an image and stitch it together with another image to create a third image with both originals appearing side-by-side.
As I understand it, Imagemagick's Convert() provides the functionality I need. I've been going through PHPs Imagmagick functionality, but I'm having trouble finding a "convert" method or anything that would work.
What is the preferred method of performing this using PHP?
PHP and Convert()
-
- Posts: 2
- Joined: 2013-05-29T17:23:47-07:00
- Authentication code: 6789
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: PHP and Convert()
Imagick is not well supported and uses different syntax than Imagemagick. I would suggest you just use PHP exec() and run Imagemagick normal command line syntax with convert.
Re: PHP and Convert()
I have a lot of Imagemagick and a few Imagick examples on my website
As fmw42 said I would go with the exec() method rather than Imagick although your code should be quite simple.
As fmw42 said I would go with the exec() method rather than Imagick although your code should be quite simple.
Code: Select all
<?php
$cmd = "input1.jpg input2.jpg +append";
exec("convert $cmd append_horiz.jpg");
?>
Code: Select all
<?php
$im = new Imagick();
$im->readImage('input1.jpg');
$im->readImage('input1.jpg');
$im->resetIterator();
$appended = $im->appendImages(FALSE);
$appended->writeImage('appendImages.jpg');
$appended->destroy();
?>
-
- Posts: 2
- Joined: 2013-05-29T17:23:47-07:00
- Authentication code: 6789
Re: PHP and Convert()
Well, if that's what I have to do I'll go for it.
It just seemed odd that there wasn't a built-in way of going about it.
Thanks!
It just seemed odd that there wasn't a built-in way of going about it.
Thanks!
Re: PHP and Convert()
Imagemagick is an external program that is not built into php so you can not just use convert. Although I believe version 7 may be built into future versions of php.