Control (limit) resource usage in Magick.NET using C#

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
Ljurka
Posts: 4
Joined: 2018-07-01T13:53:12-07:00
Authentication code: 1152

Control (limit) resource usage in Magick.NET using C#

Post by Ljurka » 2018-07-01T14:02:04-07:00

I am looking for the write to way setup limit memory from backend C# code.
I see that it possible via command line -limit memory 32MiB
but could I set up it via backend C#? The rest of settings I would like to leave as is by default.

Also I see that ImageMagick.Configuration.ConfigurationFiles but do not know is it what I need or not and how it could be used if yes.

Any help would be much appreciated.

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

Re: Control (limit) resource usage in Magick.NET using C#

Post by dlemstra » 2018-07-01T22:39:39-07:00

You are looking for the ResourceLimits class.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

Ljurka
Posts: 4
Joined: 2018-07-01T13:53:12-07:00
Authentication code: 1152

Re: Control (limit) resource usage in Magick.NET using C#

Post by Ljurka » 2018-07-02T02:01:27-07:00

Thank you!
Is it enough just to set ResourceLimits.Memory=32...
or is it require more sophisticated initizlization?

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

Re: Control (limit) resource usage in Magick.NET using C#

Post by dlemstra » 2018-07-03T11:22:56-07:00

The value is in bytes so you should set it to `33554432` if you want to limit it to 32MiB
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

Post Reply