ruby on rails - Limit space and memory used by Imagemagick -


i'm used imagemagick on rails application (with rmagick) server (ubuntu) it's not big , when launch convert process imagemagick take place/memory of server (30gb hdd).

i limit memory , tmp file size, how can ?

try running command

identify -list resource 

to see resources can control/limit. gives this:

resource limits:   width: 214.7mp   height: 214.7mp   area: 4.295gp   memory: 2gib       <--- default 2 gib   map: 4gib   disk: unlimited   file: 1920   thread: 1   throttle: 0   time: unlimited 

then can control memory using commands both convert , identify , mogrify

identify -limit memory 1gib -list resource resource limits:   width: 214.7mp   height: 214.7mp   area: 4.295gp   memory: 1gib         <--- 1 gib duration of command   map: 4gib   disk: unlimited   file: 1920   thread: 1   throttle: 0   time: unlimited 

so, can see above, limited memory 1gb 1 command.

equally, can limit memory convert with

convert -limit memory 1gib -size ... file.png 

you can set memory limit in environment variable, single-shot, this:

magick_memory_limit=30000 identify -list resource resource limits:   width: 214.7mp   height: 214.7mp   area: 4.295gp   memory: 29.3kib   map: 4gib   disk: unlimited   file: 1920   thread: 1   throttle: 0   time: unlimited 

or rest of session:

export magick_memory_limit=500000 identify -list resource  resource limits:   width: 214.7mp   height: 214.7mp   area: 4.295gp   memory: 488kib   map: 4gib   disk: unlimited   file: 1920   thread: 1   throttle: 0   time: unlimited 

kurt offers great advice here.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -