php-image-resize
php-image-resize copied to clipboard
Fill color on resizeToBestFit
Hi,
Is this function planned? It would be very interesting.
Could you provide any thoughts about this feature?
I am kinda trying to scale the image to fit specific dimensions (method resizeToBestFit) and fill the rest / unused space within the giver dimensions with a color with the picture centered. Hopefully with the bool $allow_enlargment still in play. Is there a way to do this within this library? I kinda tried a lot of combos with the given resize functions and crop, but never managed to center it ;{
I'm also very interested in this option. Input: 1000 x 500 Output: 500 x 500
The input is scaled to 500 x 250 (so it will fit completely inside the output image without cropping). Then placed at 250px down from the top (centering the image) The background will then be filled with either a set color (e.g. white) or maybe use the corners of the original image to automatically select the background.
I would call it repaging or non-destructive cropping. I just can't figure out the math of the ratios :(
A PR for this is welcome.