Tushar Patel Tushar Patel - 5 months ago 33
Linux Question

How do I find imagemagick temp folder in linux?

I am new to Imagemagick and linux. How do I find temp folder of in linux. I am using Imagemagick with liferay.

$ ll
-rwxrwxrwx 1 root root 24332 Jun 3 05:56 a.pdf convert a.pdf -debug coder a.jpg Error: /syntaxerror in -file- Operand stack:

Execution stack: %interp_exit .runexec2 --nostringval--
--nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1894 1 3 %oparray_pop 1893 1 3 %oparray_pop 1877 1 3 %oparray_pop 1771 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2
--nostringval-- --nostringval-- --nostringval-- 2 %stopped_push Dictionary stack: --dict:1165/1684(ro)(G)--
--dict:0/20(G)-- --dict:77/200(L)-- Current allocation mode is local Current file position is 57 GPL Ghostscript 9.06: Unrecoverable error, exit code 1 convert: Postscript delegate failed `a.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/678. convert: no images defined `a.jpg' @ error/convert.c/ConvertImageCommand/3046.

Answer

The easiest way, is to look for any environment variables that you have set, e.g.:

  • MAGICK_TEMPORARY_PATH
  • MAGICK_TMPDIR

by running:

env | grep -i MAGICK

Else, if you haven't set any environment variable, do something that will force ImageMagick to use disk. So, for example:

convert -debug cache -limit memory 0 xc:black null:
2016-07-07T16:28:17+01:00 0:00.000 0.000u 6.9.5 Cache convert[55942]: cache.c/SetPixelCacheExtent/3737/Cache
  extend black[0] (/var/tmp/magick-55942ZyrN1AO8SfVA[3], disk, 8B)
2016-07-07T16:28:17+01:00 0:00.000 0.000u 6.9.5 Cache convert[55942]: cache.c/OpenPixelCache/4020/Cache
  open black[0] (/var/tmp/magick-55942ZyrN1AO8SfVA[-1], Map, 1x1 8B)
2016-07-07T16:28:17+01:00 0:00.010 0.000u 6.9.5 Cache convert[55942]: cache.c/DestroyPixelCache/1121/Cache
  destroy black[0]

That shows you that my machine is using /var/tmp.