Hi
It seems scripts are using high resource.
I got warning from my vps hosting.
The scripts are very simple convert script.
exec("convert .....");
Is there anything should i do after the convert like closing imagemagick or something?
Imagemagick and resource usage - Optimize?
Re: Imagemagick and resource usage - Optimize?
Add resource limits to your command line. For example, to trade memory usage for disk I/O, add '-limit memory 2mb'.
Re: Imagemagick and resource usage - Optimize?
Is there any other better way to do it?
convert 1.png image1.jpg -geometry +0+0 -compose DstOver -composite image2.jpg -geometry +100+25 -compose DstOver -composite image3.jpg -geometry +227+28 -compose DstOver -composite output.jpg
1.png has some transparent area where those three jpgs are added.
convert 1.png image1.jpg -geometry +0+0 -compose DstOver -composite image2.jpg -geometry +100+25 -compose DstOver -composite image3.jpg -geometry +227+28 -compose DstOver -composite output.jpg
1.png has some transparent area where those three jpgs are added.
Re: Imagemagick and resource usage - Optimize?
To reduce resource requirements you must trade off memory for disk I/O or impose a CPU throttle (periodically yield the CPU for at least the time specified in milliseconds, see https://www.imagemagick.org/script/reso ... nvironment). The alternatives are to use some other program to do your work or get a different host that is less restrictive about CPU and memory resources.
Re: Imagemagick and resource usage - Optimize?
But using imagemagick, is this the best method to do the work?
Re: Imagemagick and resource usage - Optimize?
The link is helpful.
Can you give me how to use "MAGICK_THROTTLE" in PHP.
I am using imagemagick with exec command
Can you give me how to use "MAGICK_THROTTLE" in PHP.
I am using imagemagick with exec command
Re: Imagemagick and resource usage - Optimize?
You can set all resources from the command line. See http://www.imagemagick.org/script/comma ... .php#limit.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Imagemagick and resource usage - Optimize?
The command you gave is probably about the best. You need at least enough memory to hold the source and destination images. that is about as small as you can get.
The MagickCore CompositeImages() function actually directly merged source into destination without cloning a new image. There is an exception to this for the image mapping and Variable Blur Mapping compositions, which require random access to the destination image, but generally, only memory to hold only the input images is needed.
The CLI interface automatically deletes the 'source' or 'overlay' image as soon as the composition can finished modifying the destination image.
The only other solution for a smaller memory footprint would be some type of image streaming composition method.
The PbmPlus (also knows as NetPbm) may be able to do this, as that image processing library is designed with image streaming in mind. HOWEVER
The MagickCore CompositeImages() function actually directly merged source into destination without cloning a new image. There is an exception to this for the image mapping and Variable Blur Mapping compositions, which require random access to the destination image, but generally, only memory to hold only the input images is needed.
The CLI interface automatically deletes the 'source' or 'overlay' image as soon as the composition can finished modifying the destination image.
The only other solution for a smaller memory footprint would be some type of image streaming composition method.
The PbmPlus (also knows as NetPbm) may be able to do this, as that image processing library is designed with image streaming in mind. HOWEVER
- the manual never mentions if a particular command deals with images 'in total' (that is reading in the whole image first - like IM does) or as a line-by-line buffered process
- images are only dealt with as raw image data, without any meta data
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Imagemagick and resource usage - Optimize?
"If you know of a image streaming (row-by-row) composition (or just overlay) command"
No. I don't know that.
Legends are here. How do i know?
No. I don't know that.
Legends are here. How do i know?
Re: Imagemagick and resource usage - Optimize?
If you haven't already read it, see http://www.imagemagick.org/script/architecture.php concerning the ImageMagick architecture. Learn why we choose the more robust but slower method for processing images. Image processing is a complex field, compromises were made to support the widest variety of image processing algorithms and image formats.