Reset image with color #1079
Replies: 4 comments 1 reply
-
Can you add an input and output image that demonstrates your issue? |
Beta Was this translation helpful? Give feedback.
-
I have a class that supports thumbnail generation and is build with imagesharp, which works great. To support more file formats I also want to support Magick. To support the resize modes I have migrated a class called ResizeHelper from Imagesharp. It also supports to set a background color. It works basically like this:
|
Beta Was this translation helpful? Give feedback.
-
I have found this solution:
|
Beta Was this translation helpful? Give feedback.
-
It looks like you want to do this: using (var image = new MagickImage("input.png"))
{
var originalWidth = image.Width;
var originalHeight = image.Height;
var targetWidth = 400;
var targetHeight = 400;
image.Resize(targetWidth, targetHeight);
image.Extent(originalWidth, originalHeight, Gravity.Center, MagickColors.Transparent);
image.Write("output.png");
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
how can I reset an image with a color?
I tried this:
But it does not work, because it will always blend transparent colors over.
Beta Was this translation helpful? Give feedback.
All reactions