Welcome Guest, Not a member yet? Register   Sign In
Can't watermark GIF images
#1

[eluser]Unknown[/eluser]
Hi,

I am watermarking images uploaded by users. Images can be jpg, gif or png.

Watermarking works fine with jpg images but when gif image is uploaded white patch appears on the image instead of semitransparent watermark.

I'm using following configuration:

1. Codeigniter version => latest
2. PHP => 5.2.X
3. GD library => GD 2
4. Overlay image is semitransparent PNG - 24 bit

5. Library initialization
Code:
$config['image_library']    = 'gd2';
     $config['source_image']     = BASEPATH.'upload_files/user_images/albums/original/'.$unprocessedImages[$i]->st_file_name;
     $config['quality']        = 100;
     $config['new_image'] = BASEPATH.'upload_files/user_images/albums/thumb1/'.$unprocessedImages[$i]->st_file_name;
     $config['wm_type'] = 'overlay';
     $config['wm_vrt_alignment'] = 'middle';
     $config['wm_opacity'] = 80;
     $config['wm_x_transp'] = 4;
     $config['wm_y_transp'] = 4;
     $config['wm_overlay_path']     =     BASEPATH.'upload_files/user_images/albums/watermarks/'.$watermark1;

     $this->image_lib->initialize($config);
     $this->image_lib->watermark();

Can anyone help me with this?
Thanks.
#2

[eluser]tomcode[/eluser]
Just a guess, jpg and png-24 come in RGB color space, while gif uses color tables. You might need to convert the gif be fore treating it.
#3

[eluser]Unknown[/eluser]
Is there any other way of doing it (without converting image)?

Have you encountered this problem before? I can post here the GIF image & watermark image if you want to check. Let me know.

Thanks
#4

[eluser]tomcode[/eluser]
No I haven't, happen to know about file formats. Won't check out for You, too burned out, no coding for me for the next weeks. You might play here, but it ain't cover watermarking.




Theme © iAndrew 2016 - Forum software by © MyBB