0

I was looking for a way of creating a new image from an existing PNG, the only different being the width/height of the image outputted.

So, I have a PNG with a height of 200x150 (black background), and I would like to output a PNG with a higher width/height but keep the black background and keep the original image in the center (x and y).

Any help would be greatly appreciated. Thanks :)

1 Answers1

0

Try use the WideImage library.

It's simple and easy.

Like this:

WideImage::load('your_image_200px.png')
    ->resize(50, 30)
    ->saveToFile('your_image_resized.jpg');

WideImage::load('your_image_200px.jpg')
    ->crop('center', 'center', 90, 50)
    ->saveToFile('your_image_croped');
Patrick Maciel
  • 4,874
  • 8
  • 40
  • 80