English 中文(简体)
2 png-24 图表
原标题:Combine 2 png-24 transparent Images using Php
  • 时间:2010-12-22 22:56:16
  •  标签:
  • php
  • image

Hello 我试图将两个透明的Png-24图像结合起来,即400width, 150hels。

背景资料:[http://www.fenixflame.net/Background-Zanaris-24.png]

And the image I want to overlay adobe the background: ["http://www.fenixflame.net/Bandos-Slayer-24.png"][2]

我尝试过使用php,但只有png-8图像来传播透明图像。 不要使用P纳克-8来aca这些图像,那不会正确。

Edit: Code 我尝试:

    $image = imagecreatefrompng("http://www.fenixflame.net/Background-Zanaris-24.png");  
$frame = imagecreatefrompng("http://www.fenixflame.net/Bandos-Slayer-24.png");
//
//imagealphablending($frame,true);
//
 $insert_x = imagesx($frame); 
  $insert_y = imagesy($frame); 
  imagecopymerge($image,$frame,0,0,0,0,$insert_x,$insert_y,100); 
//
//# Save the image to a file imagepng($image,  /path/to/save/image.png );
 imagepng($image, "/home1/fenixfla/public_html/Images/Signatures/NewImageBG.png");
//
//# Output straight to the browser.
 imagepng($image); 
//
最佳回答

I have write a small example to merge two transparent image in this link scitam.com

它对这部法典进行了细致的研究。


    $width = 200;
    $height = 200;

    $base_image = imagecreatefromjpeg("base.jpg");
    $top_image = imagecreatefrompng("top.png");
    $merged_image = "merged.png";

    imagesavealpha($top_image, true);
    imagealphablending($top_image, true);

    imagecopy($base_image, $top_image, 0, 0, 0, 0, $width, $height);
    imagepng($base_image, $merged_image);

问题回答

Use GD Library to render the image and output it in php. http://www.php.net/manual/en/ref.image.php

之后,它就得到相当的理发。 你们必须开始做这样的事情。

imagealphablending($image, false);
imagesavealpha($image, true);

确保透明度是正确的。

你们可以看到一个例子,说明我在前页here上做了什么。 这是一种超常和巨大的痛苦。 Have

如何使用校正图像(http://www.imagemagick.org/script/composite.php)

   function composite() {
      $command = "/usr/local/bin/composite [... your properties...]";
      exec($command, $output, $result);
      return ($result == 0 && $output[0] == "");
   }

http://php.net/manual/en/Function.imagecopymer.php rel=“nofollow”http://php.net/manual/en/Function.imagecopymer.php。

影像功能是PHP GD图书馆的一部分。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签