Replies: 1 comment
-
You are very close. Using using var images = new MagickImageCollection
{
new MagickImage("img1.png"),
new MagickImage("img2.png"),
};
using var result = images.Evaluate(EvaluateOperator.And); |
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
-
I want to bitmask some data I've packed in a target image with the bits in another image. Put another way, I want to treat the 32 bits of each pixel in two Png's as 32 bit integers and
&
between them. Pseudocode:for(int x = 0; x < image.width; x++){ for(int y = 0; y < image.height; y++){ result.setPixel(x,y, intToColor(colorToInt(img1.getPixel(x,y)) & colorToInt(img2.getPixel(x,y))); } }
I'd like to do this ideally without the 2d loop since I'm presuming ImageMagick has a more performant non-naive way to achieve the same.
magick convert -colorspace RGB img1.png img2.png -evaluate-sequence AND result.png
-- this command appears to achieve what I'm after. I don't see a way to do -evaluate-sequence in Magic.Net, there's also no overload of .Evaluate that takes two image arguments.https://www.imagemagick.org/discourse-server/viewtopic.php?t=19995 -- This topic has somebody trying a similar thing with the XOR operator. ImageMagick's docs have some things around the -fx command that make me think it's achievable, but I haven't found any way to do a call to .fx in Magic.Net that takes two image arguments.
I accept that my head's probably stuck in programmer mode and there's some blend modes that I could use with .Composite to achieve this. I'm just not seeing it. Maybe CompositeOperator.Mathematics? How's that work?
I feel like I'm close, but I'm stuck. Any guidance would be appreciated.
Thank you for your time.
-Josh
Beta Was this translation helpful? Give feedback.
All reactions