Jump to content

Images- Have a certain color color over transparently certain parts of image?


Recommended Posts

See, I have this script made for watermarks that layers two images together, here:

 

http://dragon-dynasty.com/script2.php

 

Now, I need to add code somewhere [where? =x] to have a certain color that I need to be able to specify transparently color over JUST the dragon.

 

Any ideas?

Why don't you add the color to the dragon before merging it with the other image? That way you don't have to worry about trying to just color a specific part of the image when it is already merged together.

 

This page has a lot of useful functions that will help you with the coloring part:

http://php.net/imagecolorallocate

 

Yeah, there are functions on that URL I gave you that can color by hex code, so it would be perfect for what you are doing.

 

So first call the function to color the dragon, THEN merge it with the other image, that way the dragon will be already colored when they merge together.

Lmao, it's probably because messaging people for help is against the rules, the moderators take that pretty seriously =/

 

Wait, so now you are only wanting to color certain parts of the dragon? I thought that you were wanting the dragon just one color but you didn't know how to color the dragon without coloring the other image you just merged with it as well. I'm confused...

I think I found what you are looking for xD

 

imagefilledarc()

http://www.php.net/manual/en/function.imagefilledarc.php

 

It allows you to specify coordinates and a color for the area you are trying to color.

I need Barand's help, but he won't reply to my PM. -laughs-

 

I don't recall any recent PM's from you, but I do remember PMing you to follow up on a solution I gave you, just to check if it worked OK, and not receiving any reply. So I may have just binned your latest request.

Eh, I wasn't aware of that. I just replied to a PM he sent me. Sorry. x.x

 

No- that's feature draws an arc. On the BASE DRAGON image, I need JUST the dragon's lines filled in with a hex color I will specify.

 

Barand- you gave me a script that'll replace all of a certain color with a different color- would you happen to still have that script, I think I've misplaced it.

Was it this one

 

<?php
$skinfile = isset($_GET['skin']) ? $_GET['skin'] : 'bluetexture.gif';

$skin = imagecreatetruecolor(500,508);
$tile = imagecreatefromgif($skinfile);
imagesettile($skin, $tile);
imagefill($skin, 250, 205, IMG_COLOR_TILED);
/**
* convert dragon png to truecolor
*/
$im = imagecreatetruecolor(500,508);
$dragon = imagecreatefrompng('reddragon.png');
imagecopy($im,$dragon,0,0,0,0,500,508);

/**
* select color to be replaced by skin
*/
$red = imagecolorat($im, 255,400);
for ($x=0; $x<500; $x++) {
    for ($y=0; $y<508; $y++) {
        if (imagecolorat($im,$x,$y) == $red) {
            $skinpix = imagecolorat($skin,$x,$y);
            imagesetpixel($im,$x,$y,$skinpix);
        }
    }
}
header("content-type: image/png");
imagepng($im);
imagedestroy($im);
imagedestroy($skin);
imagedestroy($dragon);
imagedestroy($tile);
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.