From 794dc669323a92704b7c0825143be40796601c2e Mon Sep 17 00:00:00 2001 From: hugoblanc Date: Tue, 17 Dec 2024 17:03:21 +0100 Subject: [PATCH] docs: add image magick config helper --- README.md | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 80127e6..75e7688 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # ppt-png + Convert ppt to image (png,jpg). [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-stats] [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=w3nl_ppt-png&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=w3nl_ppt-png) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=w3nl_ppt-png&metric=bugs)](https://sonarcloud.io/summary/new_code?id=w3nl_ppt-png) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=w3nl_ppt-png&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=w3nl_ppt-png) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=w3nl_ppt-png&metric=coverage)](https://sonarcloud.io/summary/new_code?id=w3nl_ppt-png) @@ -9,9 +10,9 @@ If you want convert powerpoint files to png or jpg images, you can do it with th The package requires the following software to be installed: -* LibreOffice-dev -* ImageMagick -* pdfinfo +- LibreOffice-dev +- ImageMagick +- pdfinfo ## Installation @@ -27,7 +28,6 @@ Mac: `brew install imagemagick poppler ghostscript` - ## Basic Usage (node.js) ``` @@ -45,7 +45,20 @@ files: Array with the files. output: Output folder. +## ImageMagick settings + +Image Magick can crash with segmentation fault (core dumped) or other errors. If you have more memory available, you can increase the memory default limits. + +```Dockerfile +# Configure ImageMagick for PDF conversion with increased memory limits +RUN if [ -f /etc/ImageMagick-6/policy.xml ]; then \ + sed -i 's///g' /etc/ImageMagick-6/policy.xml && \ + sed -i 's///g' /etc/ImageMagick-6/policy.xml; \ + fi +``` + ### Todo: + invert: Invert the colors, default is `false`; greyscale: Greyscale the colors, default is `false`; @@ -64,7 +77,6 @@ height: Height of the output images if density is not used logLevel: Set the log level, default is `1`. - ## Test the package. ``` @@ -79,7 +91,6 @@ If you only want to check the eslint rules, just run. npm run lint ``` - [downloads-image]: https://img.shields.io/npm/dm/ppt-png.svg [npm-url]: https://www.npmjs.com/package/ppt-png [npm-image]: https://img.shields.io/npm/v/ppt-png.svg