Replies: 1 comment
-
Can you also attach your images so I can see what you are trying to do? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
How can I add an image on to another image?
I need to manipulate both images differently.
The first must be grayscale and the second (top) must be pink with opacity.
Anything I tried was producing the same results where the manipulation of the first image always override the second hence, the end image was a grayscale image.
I've tried both Composite and MagickImageCollection methods.
I'm on .net core 3.1 with Q16 any CPU.
I've tried this code with no success:
` using (var image = new MagickImage("C:\1.jpeg"))
{
image.Grayscale();
image.BrightnessContrast(new Percentage(15), new Percentage(5));
using (var overlay = new MagickImage("C:\pink.png"))
{
overlay.Alpha(AlphaOption.On);
overlay.BrightnessContrast(new Percentage(15), new Percentage(5));
image.Composite(overlay, CompositeOperator.Overlay);//also over
image.Write("C:\res.png");
However, I managed to get the result using the following;
using (var image = new MagickImage("C:\1.jpeg"))
{
image.Grayscale();
image.BrightnessContrast(new Percentage(15), new Percentage(5));
using (var overlay = new MagickImage("C:\pink.png"))
{
overlay.Alpha(AlphaOption.On);
overlay.BrightnessContrast(new Percentage(15), new Percentage(5));
using (var outputImage = new MagickImage("C:\1.jpeg"))
{
outputImage.Composite(image, CompositeOperator.Over);
outputImage.Composite(overlay, CompositeOperator.Overlay);
outputImage.Write("C:\res.png");
}
}
}`
I'm sure there is a better way of doing this.
Thanks
aa
Beta Was this translation helpful? Give feedback.
All reactions