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 513035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:22:51+00:00 2026-05-13T07:22:51+00:00

I am building one kind of system, which simply creates dynamic image from other

  • 0

I am building one kind of system, which simply creates dynamic image from other image. I use: imagecreatefromstring(file_get_contents("clown_avatar.png")); to create image and output it successfully; but, it messes all the colors on the transparent area.

Check out the original image:

Click

And, here is the result from PHP file:

Click

Here is the source, just few rows:

<?php

$im = imagecreatefromstring(file_get_contents("clown_avatar.png"));
//$bg = imagecolorallocate($im,0,0,0); doesn't effect
Header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);

?>

I tried to add background color with imagecolorallocate; but, it did not effect at all.

  • 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-05-13T07:22:52+00:00Added an answer on May 13, 2026 at 7:22 am

    The reason for this is that you are discarding the alpha layer. By doing so, the otherwise invisible parts of the image now become visible.

    What you instead want to do, is load the original PNG image with alpha, and copy it onto a desired image (that is solely the background color) using imagecopymerged.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a game of which the interface is one of the first items
i am building this sms notification system, which will send 10 times free sms
I'm building a small-scale website (a personal one) in which each page would have
I'm building a site which makes use of the popular 960.gs 16 column grid
I'm designing/building a system of classes that all derive from a single base class.
So I am thinking about building a hobby project, one off kind of thing,
How does one approach building the mobile app version of one's Rails app, with
More than one time I have encountered the following problem when building code with
I am building a cross platform product and one of the requirements is across
I am building a WAR/EAR and one of my components reads in many custom

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.