我经常使用ImageMagick的convert
来进行* – > PNG转换,但是当PDF有超过50页的时候 – convert
吃更多3吉姆(!!!)的内存。 我想它首先加载一切。
这是不可接受的。 它应该逐页阅读PDF,为什么一下子把它们全部搞定!
也许有办法调整它不知何故? 或者有什么好的select?
你试过caching吗?
从手册页
– caching阈值
megabytes of memory available to the pixel cache. Image pixels are stored in memory until 80 megabytes of memory have been consumed. Subsequent pixel operations are cached on disk. Operations to memory are significantly faster but if your computer does not have a sufficient amount of free memory you may want to adjust this threshold value.
解决以下问题:
cat <<EOF > /etc/profile.d/ImageMagick.sh # Set ImageMagick memory limits: it eats too much export MAGICK_MEMORY_LIMIT=1024 # Use up to *MB of memory before doing mmap export MAGICK_MAP_LIMIT=1024 # Use up to *MB mmaps before caching to disk export MAGICK_AREA_LIMIT=4096 # Use up to *MB disk space before failure export MAGICK_FILES_LIMIT=1024 # Don't open more than *file handles EOF
我正在使用以下内容:
convert -limit memory 64 -limit map 128 original.djvu newfile.pdf
我的主驱动器空间有限,所以我预先安装了一个variables
env MAGICK_TMPDIR=/host/Temp convert -limit memory 64 -limit map 128 original.djvu newfile.pdf