PHP stitching pictures and before pictures keep the color before

Source: Internet
Author: User
Tags imagecopy
I have a function to stitch two pictures below is my Code

    $im     = imagecreatefrompng("images/err.png");    $stamp = imagecreatefrompng('images/default.png');    $test = imagecreate(imagesx($stamp)+imagesx($im),imagesy($im));    $orange = imagecolorallocate($test, 255, 255, 255);   // image    imagecopy($test, $stamp, 0, 0, 0, 0, imagesx($stamp), imagesy($stamp));    imagecopy($test, $im, imagesx($stamp), 0, 10, 0, imagesx($im), imagesy($im));    header("Content-type: image/png");    imagepng($test);    最终的结果是 第二个拼接的图片的颜色都会跟着第一个变化 因为传不片只能文字描述下面假如AB是拼接好的图片 有A和B拼接成 B的颜色本来是红色但是拼接完成之后B的颜色会变成A的颜色

Ab

Reply content:

I have a function to stitch two pictures below is my Code

    $im     = imagecreatefrompng("images/err.png");    $stamp = imagecreatefrompng('images/default.png');    $test = imagecreate(imagesx($stamp)+imagesx($im),imagesy($im));    $orange = imagecolorallocate($test, 255, 255, 255);   // image    imagecopy($test, $stamp, 0, 0, 0, 0, imagesx($stamp), imagesy($stamp));    imagecopy($test, $im, imagesx($stamp), 0, 10, 0, imagesx($im), imagesy($im));    header("Content-type: image/png");    imagepng($test);    最终的结果是 第二个拼接的图片的颜色都会跟着第一个变化 因为传不片只能文字描述下面假如AB是拼接好的图片 有A和B拼接成 B的颜色本来是红色但是拼接完成之后B的颜色会变成A的颜色

Ab

The picture is not visible, please do not put the picture in the Code view.

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