Repository navigation
Change background color when ResizeMode.Pad #466
Copy link
Copy link
Closed
Milestone
Description
Activity
Solution
Searching inside the package I found the following extension "BackgroundColor" that meet my needs.
Example
newImage.Mutate(x => x .Resize(new SixLabors.ImageSharp.Processing.ResizeOptions { Size = new SixLabors.Primitives.Size(newWidth, newHieght), Mode = SixLabors.ImageSharp.Processing.ResizeMode.Pad }) .BackgroundColor(new Rgba32(12, 12, 221)) );Reacted by James Jackson-South, Stilgar, Matthew D. Groves, dhabierre, Mark Szabo, Aingeru, Charlie and vikas-upadhyay-npsReopening as the solution can be improved upon.
We should add a parameter to the explicit
Padmethod to allow a shortcut to setting the color..Mutate(x => x.Pad(int width, int height, TPixel color)).Mutate(x => x.Pad(GraphicsOptions options, int width, int height, TPixel color))Resizeitself will probably stay the same as we don't want to makeResizeOptionsa generic type.Reacted by Stilgar, Mark Szabo, FrogsLegs, Andrey Nikutin and NTDLSReacted by Rafael Rivera1 year later and I've decided against merging the two methods as it adds internal complexity that I don't think is worth it when you can simply chain commands like above.
Actually. I'm being an idiot. Gimme 5 minutes.
Reacted by Michael Auerswald- added a commit that references this issue
on May 25, 2019 - added a commit that references this issue
on May 25, 2019 - added a commit that references this issue
on Aug 25, 2019
Description
It's possible to change the background color when resizing image with mode Pad. Now is always black, but I would like to change it to other colors.
Steps to Reproduce