PHP GD issues with ImageCreateTrueColor and PNGs

Posted by DrPheltRight on Stack Overflow See other posts from Stack Overflow or by DrPheltRight
Published on 2010-04-15T18:20:09Z Indexed on 2010/04/15 18:23 UTC
Read the original article Hit count: 120

Filed under:
|
|
|
|

I am resizing PNG images using the GD image library function ImageCopyResampled(). It all works fine, I can even keep alpha blending transparency with the use of ImageCreateTrueColor() rather than using ImageCreate() to create the resized image.

The problem is, that if I use ImageCreateTrueColor() rather than ImageCreate() the file size of PNG files increases from something like 80kb to 150kb. If I use ImageCreate() the file size stays around the same size, but colors screw!

So my question is, how can I retain alpha blending when resizing PNG images without increasing the file size?

Oh and I am reducing the dimensions of the PNGs.

© Stack Overflow or respective owner

Related posts about php

Related posts about gd