Imagemagick stacked graph

Source: Internet
Author: User
Tags imagemagick
How can I use the imagemagick library to implement the imagecopyresampled function in the GD library? I folded the two pictures and read the English documents. I am looking for a shortcut. even if I tell a method name to study it myself, thank you!


Reply to discussion (solution)

// Open the file $ imgA = "phpcn_logo.gif"; $ imgB = "phpchina.gif"; $ sourceImg = imagecreatefromgif ($ imgA); $ targetImg = imagecreatefromgif ($ imgB ); // get the file size $ sourceSize = getimagesize ($ imgA); $ targetSize = getimagesize ($ imgB); // merge images imagecopyresized ($ targetImg, $ sourceImg, 0, 0, 0, 0, 0, $ targetSize [0], $ targetSize [1], $ sourceSize [0], $ sourceSize [1]); // Save the result $ r = imagegif ($ targetImg, "c.gif"); if ($ r) {echo "success" ;}else {echo "failed ";}

// Open the file $ imgA = "phpcn_logo.gif"; $ imgB = "phpchina.gif"; $ sourceImg = imagecreatefromgif ($ imgA); $ targetImg = imagecreatefromgif ($ imgB ); // get the file size $ sourceSize = getimagesize ($ imgA); $ targetSize = getimagesize ($ imgB); // merge images imagecopyresized ($ targetImg, $ sourceImg, 0, 0, 0, 0, 0, $ targetSize [0], $ targetSize [1], $ sourceSize [0], $ sourceSize [1]); // Save the result $ r = imagegif ($ targetImg, "c.gif"); if ($ r) {echo "success" ;}else {echo "failed ";}
Don't use the GD Library. I have implemented this because the speed is too slow and I want to change to imagemagick.

It has already been implemented, and the document has been read and spam, so I won't talk about code.

$image = new Imagick('05.png');$imagepng = new Imagick('16.png');$imagepng->setImageFormat("png");$image->compositeImage($imagepng, $imagepng->getImageCompose(), 0, 0);$imagepng->destroy();header("Content-Type: image/png");echo $image;$image->destroy();

Use imagick directly.

$cmd = sprintf("composite -gravity %s -geometry %s -dissolve %s '%s' %s %s", 'SouthEast', '+10+10', 100, '16.png', '05.png', '05.png');  exec($cmd); 

Use imagick directly.

$cmd = sprintf("composite -gravity %s -geometry %s -dissolve %s '%s' %s %s", 'SouthEast', '+10+10', 100, '16.png', '05.png', '05.png');  exec($cmd); 

Thank you. I want to output it directly. I don't know if it is feasible to directly use shell. In addition, it may be possible to port it to iis in the future. I still want to use extended insurance.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.