Negate images on MagickNET

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
pablobhz
Posts: 51
Joined: 2016-05-07T06:47:14-07:00
Authentication code: 1151

Negate images on MagickNET

Post by pablobhz » 2017-03-23T07:00:49-07:00

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

User avatar
dlemstra
Posts: 1382
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Negate images on MagickNET

Post by dlemstra » 2017-03-23T17:02:05-07:00

Have you tried to just do currImage.Negate()?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

pablobhz
Posts: 51
Joined: 2016-05-07T06:47:14-07:00
Authentication code: 1151

Re: Negate images on MagickNET

Post by pablobhz » 2017-03-23T17:08:41-07:00

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

User avatar
dlemstra
Posts: 1382
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Negate images on MagickNET

Post by dlemstra » 2017-03-23T17:23:32-07:00

What happens when you do "ColorSpace = ImageMagick.ColorSpace.CMYK;" inside the foreach loop? (after the negate)
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

pablobhz
Posts: 51
Joined: 2016-05-07T06:47:14-07:00
Authentication code: 1151

Re: Negate images on MagickNET

Post by pablobhz » 2017-03-23T17:26:52-07:00

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

User avatar
dlemstra
Posts: 1382
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Negate images on MagickNET

Post by dlemstra » 2017-03-23T17:36:39-07:00

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.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

pablobhz
Posts: 51
Joined: 2016-05-07T06:47:14-07:00
Authentication code: 1151

Re: Negate images on MagickNET

Post by pablobhz » 2017-03-23T17:42:53-07:00

Perhaps I could try an earlier version of MagickNET ?
I'm using the AnyCPU version (latest) from NuGet.

User avatar
dlemstra
Posts: 1382
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Negate images on MagickNET

Post by dlemstra » 2017-03-23T17:47:10-07:00

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.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

pablobhz
Posts: 51
Joined: 2016-05-07T06:47:14-07:00
Authentication code: 1151

Re: Negate images on MagickNET

Post by pablobhz » 2017-03-23T17:49:51-07:00

Okay I will wait .
If needed I can supply the images I'm using (testing purposes )
Thanks in advance

User avatar
dlemstra
Posts: 1382
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Negate images on MagickNET

Post by dlemstra » 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.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

pablobhz
Posts: 51
Joined: 2016-05-07T06:47:14-07:00
Authentication code: 1151

Re: Negate images on MagickNET

Post by pablobhz » 2017-03-23T17:55:00-07:00

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 :)

Post Reply