Jump to content

ImageCopy Color and Resolution Loss


Patriot

Recommended Posts

1-3.gif

 

The gift on the right side is dynamically placed on the background using image copy.  Before the copy, the image of the gift looks fine.  Now it loses color and turns pinkish.

 

CODE:

	     
$banner     = imagecreatefromgif("tbg1.gif");
$prizeimage = imagecreatefromgif("tgt1.gif");
$fontcolor  = imagecolorallocate($banner, 0, 0, 0);
imagettftext($banner, 13, 0, 7, 74, $fontcolor, "myriadregpro.otf", "Stuff: " . $prize);
imagecopyresampled($banner, $prizeimage, 312, 4, 0, 0, 84, 97, 84, 97);

 

Does anyone know what is wrong?

Link to comment
Share on other sites

howdy, i lost the previous thread on this. can you provide both original images and i'll take a shot at getting one on the other without losing color/resolution/etc.? if you can just post a link to both originals or whatever, i'll hack the code together here and (hopefully) figure out the problem.

 

Link to comment
Share on other sites

see if this works for you. i don't have the font, so i left it out. shouldn't make a difference, but you should un-comment it for testing.

 

<?php
$complete_img = imagecreatetruecolor(400,105);
$banner     = imagecreatefromgif("tbg1.gif");
$prizeimage = imagecreatefromgif("tgt1.gif");

//$fontcolor  = imagecolorallocate($complete_img, 0, 0, 0);
//imagettftext($complete_img, 13, 0, 7, 74, $fontcolor, "myriadregpro.otf", "Stuff: " . $prize);

imagecopy($complete_img, $banner, 0, 0, 0, 0, 400, 105);
imagecopy($complete_img, $prizeimage, 312, 4, 0, 0, 84, 97);

header('Content-type: image/jpeg');
imagejpeg($complete_img, null, 100); // Finished image is $complete_img
?>

 

 

 

Link to comment
Share on other sites

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.