Welcome Guest, Not a member yet? Register   Sign In
image_lib - Transparent PNG problem
#1

[eluser]Ficoder[/eluser]
Hi,
I use image_lib in my current project and i found that it works strangely sometimes. In my example i have made four PNG images with PHP GD, and those images only contains black text and transparent background. Font is Bodoni MT and used font sizes 12, 14, 21, 23 in this example situation. Then i used CodeIgniter 2.1.0 image_lib to watermark those images separately to white 400x400 JPG-image.

Code is here:

Code:
public function ImageTest()
  {
      $this->load->library('image_lib');
      
      $config['source_image'] = './img/white_background.jpg';
      $config['wm_overlay_path'] = './img/text_size_21.png';
      $config['wm_opacity'] = 100;
      $config['wm_type'] = 'overlay';
      $config['wm_vrt_alignment'] = 'top';
      $config['wm_hor_alignment'] = 'left';
      $config['wm_hor_offset'] = 20;
      $config['wm_vrt_offset'] = 20;
      $config['quality'] = 100;
      $config['new_image'] = './img/final_image_size_21.jpg';

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

You can see results here -> http://elektroniikka.org/temp/codeigniter/

As you can see, images (text_size_xx.png) all are with transparent background and doesn't contain any black background. But when you see results after CodeIgniter's watermarking (final_image_size_xx.jpg), you can see that with font-size 14 and 21, there is something wrong.

I don't know what is causing this. If i change that "Example text" to something else, it is possible that font-size 23 is giving this black background, even though it works in this example.




Theme © iAndrew 2016 - Forum software by © MyBB