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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:28:05+00:00 2026-05-12T08:28:05+00:00

I have a watermark script I am working on, the results are good on

  • 0

I have a watermark script I am working on, the results are good on PNG and on JPG images however a gif image, not so good. I am using PHP and GD

Below you can see the difference in quality of the watermark.

Anyone know how to improve this?

For the gif version I am using

$image = imagecreatefromgif($source_file);
imagecopymerge($image, $watermark, $x, $y, 0, 0, $water_width, $water_height, 65);
imagegif($image, $source_file);

gif image = bad quality
gif image http://img2.pict.com/fd/46/00/1471179/0/gif.gif

jpg image = good
jpg image http://img2.pict.com/82/a1/5a/1471181/0/jpg.jpg

  • 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-12T08:28:06+00:00Added an answer on May 12, 2026 at 8:28 am

    GIF images have a fixed palette that can contain a maximum of 256 colors. The issue here is probably that the image your inserting uses colors that isn’t available in the target image.

    I have never tried this, but it might be worth a shot. You could try converting the gif image to a true color image first, then do the watermarking and after that converting it back to gif.

    $image = imagecreatefromgif($source_file);
    // create a true color image of the same size
    $image2 = imagecreatetruecolor(imagesx($image), imagesy($image));
    // copy the original gif image on to the true color image
    imagecopy($image2, $image, 0, 0, 0, 0, imagesx($image), imagesy($image));
    // copy the watermark onto the new true color image
    imagecopymerge($image2, $watermark, $x, $y, 0, 0, $water_width, $water_height, 65);
    // write the new image to disk
    imagegif($image2, $source_file);
    

    Try it and see if it makes a difference.

    There’s also a couple of palette manipulation functions available that might help:

    1. imagecolormatch()
    2. imagetruecolortopalette()
    3. imagepalettecopy()

    I’m not sure how you would apply them, but I’m guessing that there’s a few things you could do to improve the results.

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

Sidebar

Related Questions

I have php script that creates a temporary watermark image for users that are
I have script that add water mark (PNG, transparent) to image(JPG). Works fine with
I have line: imagejpeg($this->image, $file, $quality); How can add on this image watermark.png?
Why is this jquery image watermarking plugin not working? I am using the code
I have a PNG watermark image with transparent background. But randomly it generates a
I have this code for placing a transparent PNG image watermark on photos. It
Hi I am integrating the watermark code http://koivi.com/php-gd-image-watermark/ This script works well. But I
I have a PHP script that initialises an image gallery. It loops through all
I have a PHP function that I use regularly for working with images (resizing,
I'm using phpThumb in a script to clean my images and add a watermark

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.