Gregwar / Image

A PHP library to handle images
MIT License
1k stars 191 forks source link

Fill transparent image with white background #21

Closed abhimanyu003 closed 11 years ago

abhimanyu003 commented 11 years ago

If I use this

<img src="<?php echo Image::open('tux.png')->jpeg(); ?>" />

png image is filled with black background.

Example

From this

tux


To this

1849d6a880ed1632bd6e2b2700c5dc75e13


But if i use this code

<img src="<?php echo Image::open('tux.png')->zoomCrop(400, 479)->jpeg(); ?>" >

Every thing works fine the image is filled with white background not black.

What i have to do to fill image with white background not black while converting it form png to jpg

Gregwar commented 11 years ago

Hi, i've added a fillBacckground() method, so now you can do:

<img src="<?php echo Image::open('tux.png')->fillBackground('white')->jpeg(); ?>" >
Gregwar commented 11 years ago

(Tell me if it's ok for you)

abhimanyu003 commented 11 years ago

Thanks a lot works great.