Setting thread limit = 1 programmatically in Magick++

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
vigri
Posts: 2
Joined: 2015-07-14T15:33:29-07:00
Authentication code: 1151

Setting thread limit = 1 programmatically in Magick++

Post by vigri »

Hello,

when I want to "disable" OpenMP while using the convert command I simply use

Code: Select all

convert -limit thread 1 in.png out.jpg
Now I've a C++ program where I'm using the Magick++ API.

My question: Is there a way to limit the maximum thread amount programmatically?

I know about setting MAGICK_THREAD_LIMIT=1 in /etc/Environment - but I would like to set the limit in my code.

Best regards.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Setting thread limit = 1 programmatically in Magick++

Post by dlemstra »

If you have a new version of ImageMagick you can do this with the ResourceLimits class.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
vigri
Posts: 2
Joined: 2015-07-14T15:33:29-07:00
Authentication code: 1151

Re: Setting thread limit = 1 programmatically in Magick++

Post by vigri »

Hello,

thanks for your reply.
Can you give me please a little bit more Information?

I'm using IM 6.9.1

Best regards
olear
Posts: 58
Joined: 2015-05-24T10:56:42-07:00
Authentication code: 6789

Re: Setting thread limit = 1 programmatically in Magick++

Post by olear »

Magick::ResourceLimits::thread(X);
Post Reply