-1

on my local machine, I wrote a script that uses ImageMagick's convert many times. One of the most used commands is this:

convert -size 4200x5100 xc:blue sth.jpg

. On my local machine, it runs about 1s, which is OK. It does not use too many resources.

When I deployed the program to 2 different servers, they started to use the disk very powerfully and the same run took about 9 seconds instead of one.

I figured out that on the servers it creates a file (filename is like: /tmp/magick-30416RF1uGkxsk3ms) which is exactly 250.000.000 bytes big.

On the local machine, this file does not get created.

The versions are: local machine: laptop, Ubuntu 16.04, lenovo t440. IM / convert version: 6.8.9-9

Server1: debian 10.8, week fresh install, vps, IM / convert version: 6.9.10-23

Server2: physical machine, debian 9.6, IM / convert version: 6.9.7-4

.

My question is what can cause this huge difference between the local machine and the servers? How can I prevent ImageMagick to create this monster big temporary file?

Or is it a new feature in 6.9 versions??

user2194805
  • 1,201
  • 1
  • 17
  • 35
  • I found, that it should be some memory related issue. If I create the file with lower resolution, it does not use the disk... . However, it still does not solve my problem. – user2194805 Feb 27 '21 at 15:47
  • I think there is an option about this. This is not the first time I saw people having such problems (but I do no remember the solution). Possibly you should check on our sister sites (look at the top right icon). Your question is about a program and not programming (maybe superuser, or unix&linux, or Ubuntu sister site) – Giacomo Catenazzi Feb 27 '21 at 16:26
  • If this is your server and not a shared server, then you can change your resources (memory allocation) etc using the policy.xml file. You may have limited memory allowed and so ImageMagick will use disk resources in stead for large images. – fmw42 Feb 27 '21 at 16:55
  • You might try running `identify -version` on the various machines and see if they report Q8 or Q16 which gives the bits per sample in memory. – Mark Setchell Feb 27 '21 at 18:17
  • It's Q16 on all the 3 servers. – user2194805 Feb 27 '21 at 18:28
  • @fmw42: Interesting to see this config file. I doubled 3 values (memory, map, area), and it seems to work much better, with no temp file. Now I just need to figure out which is which. – user2194805 Feb 27 '21 at 18:30
  • @GiacomoCatenazzi I checked the 3 sites You mentioned, but unfortunately I did not find it. I'd be interested to have another solution (maybe a parameter to convert). – user2194805 Feb 27 '21 at 18:37

1 Answers1

0

I need to increase the value of area and/or map and/or memory in the /etc/ImageMagick-6/policy.xml file . It'll solve the issue.

user2194805
  • 1,201
  • 1
  • 17
  • 35