Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fill color on resizeToBestFit #165

Open
thomasherisson opened this issue Aug 11, 2020 · 4 comments
Open

Fill color on resizeToBestFit #165

thomasherisson opened this issue Aug 11, 2020 · 4 comments

Comments

@thomasherisson
Copy link

Hi,

Is this function planned?
It would be very interesting.

@peter279k
Copy link
Contributor

Could you provide any thoughts about this feature?

@nedved-vojtech
Copy link

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 ;{

@andyg2
Copy link

andyg2 commented Oct 1, 2021

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 :(

@adityapatadia
Copy link
Contributor

A PR for this is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants