Page 1 of 1

Negate images on MagickNET

Posted: 2017-03-23T07:00:49-07:00
by pablobhz
Hello.
I've analyzed the Object Reference inside visual studio, for negating images. However, the output (final image) isn't being the expected.

I'm using this approach:

Code: Select all

                foreach(MagickImage currImage in images)
                {
                    currImage.Negate(true, ImageMagick.Channels.All);                    
                }
                using (MagickImage image = images.Combine())
                {
                    image.ColorSpace = ImageMagick.ColorSpace.CMYK;
                    image.Write(@"C:\DI_PLOT\Bitmaps\combineoutput2.tif");
                }
However the output isn't the same the ImageMagick(command line) does. Do i have to rewrite into the memory the negated image before proceed ?

Thanks in advance

Re: Negate images on MagickNET

Posted: 2017-03-23T17:02:05-07:00
by dlemstra
Have you tried to just do currImage.Negate()?

Re: Negate images on MagickNET

Posted: 2017-03-23T17:08:41-07:00
by pablobhz
dlemstra wrote: 2017-03-23T17:02:05-07:00 Have you tried to just do currImage.Negate()?

Yeah I did
Also I tried to add the negated images to a new MagickImage collection , same result .

Of course , when combining I have different results if I set the colorspace to cmyk or not ; my impression is that by leaving the colorspace the default (it combines to an rgb colorspace) the image is darker .

The negate method is void , so I can't Store its results anywhere else ; I consider the current image an object , so , when doing currImage.Negate() it should be automatically denied .

I'll try to write the negate output and check if it is really changing something

Re: Negate images on MagickNET

Posted: 2017-03-23T17:23:32-07:00
by dlemstra
What happens when you do "ColorSpace = ImageMagick.ColorSpace.CMYK;" inside the foreach loop? (after the negate)

Re: Negate images on MagickNET

Posted: 2017-03-23T17:26:52-07:00
by pablobhz
dlemstra wrote: 2017-03-23T17:23:32-07:00 What happens when you do "ColorSpace = ImageMagick.ColorSpace.CMYK;" inside the foreach loop? (after the negate)
Yeah I did . And the output was a totally white image .
The original images are on the Gray colorspace . If I force them to cmyk things go wrong

Re: Negate images on MagickNET

Posted: 2017-03-23T17:36:39-07:00
by dlemstra
This might be a bug then. I cannot investigate this properly this week but I will be able to take a look at this next weekend.

Re: Negate images on MagickNET

Posted: 2017-03-23T17:42:53-07:00
by pablobhz
Perhaps I could try an earlier version of MagickNET ?
I'm using the AnyCPU version (latest) from NuGet.

Re: Negate images on MagickNET

Posted: 2017-03-23T17:47:10-07:00
by dlemstra
It looks like this bug has been in the library for a long time. The colorspace should be an argument for the Combine instead of the channels argument that it has now. I cannot get you a fix earlier because I am traveling with just my phone. I will try to publish a new release next weekend that fixes this.

Re: Negate images on MagickNET

Posted: 2017-03-23T17:49:51-07:00
by pablobhz
Okay I will wait .
If needed I can supply the images I'm using (testing purposes )
Thanks in advance

Re: Negate images on MagickNET

Posted: 2017-03-23T17:51:57-07:00
by dlemstra
I assume I can use the images from this topic: https://www.imagemagick.org/discourse-s ... 27&t=31621.

Re: Negate images on MagickNET

Posted: 2017-03-23T17:55:00-07:00
by pablobhz
dlemstra wrote: 2017-03-23T17:51:57-07:00 I assume I can use the images from this topic: https://www.imagemagick.org/discourse-s ... 27&t=31621.

Exactly this topic . I got the directions for doing the combine thing using ImageMagick and then I got how to do it with MagickNET

But I still have a question about combine an cmyk image with an specific color . Will ask later

Really thanks for the attention . Most communities ignore newbie questions :)