Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8274133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:38:49+00:00 2026-06-08T07:38:49+00:00

I am trying to create an image from an another image using PHP. Here

  • 0

I am trying to create an image from an another image using PHP. Here is my code:

<?php
    $width = 109;
    $height = 109;
    $image = imagecreatetruecolor($width, $height);
    $source_under = imagecreatefrompng('ecloid_under.png');
    $black = imagecolorallocate($image, 0x00, 0x00, 0x00);

    imagecolortransparent($image, $black);

    imagecopy($image, $source_under, 0, 0, 0, 0, $width, $height);

    header('Content-type: image/png');
    imagepng($image);
    imagedestroy($image);
?>

So I am loading this image in $source_under

enter image description here

and copying it over a transparent blank “canvas” image. Here is the result of that operation:

enter image description here

As can be seen, there is a sort of black border around the whole initial image. I think this is due to the fact that initially, the “canvas” image is all black. So there is something wrong with the transparency and the anti-aliasing of the image.

This isn’t the first time I have a similar problem, but last time the source image was the cause. This time around, opening it in Photoshop does not show any potential problems with it.

Does anyone know how to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:38:51+00:00Added an answer on June 8, 2026 at 7:38 am

    Can you try to enable alpha blending on $image before you copy the original to it:

    imagealphablending($image, true); 
    

    Second try would be to create a transparent color and to fill $image with that color before the copy.

    $transparent = imagecolorallocatealpha($image, 0, 0, 0, 127);
    imagefill($image, 0, 0, $transparent);
    imagealphablending($image, true); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create an image by using binary data that I received from
I am trying to create a dynamic image that will be created from PHP
I have been trying to create an image from PDF using c#, I have
I am trying to create a Security Image from a text using the perl
have a nice day. I got problem when trying to create an image from
I'm trying to create a CCSprite from an image on disk. The file is
I'm trying to create an image using matplotlib.pyplot.imshow() . However, when I run the
Im trying to combine an image I create from a blob I pull from
I'm trying to load an image from the web. The code I have so
I am trying to create a transparent PNG image from a BufferedImage in Java.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.