Stabs 0,6.13 < /li>
Webserver: Nginx 1.24.0 < /li>
Gunicorn -Version: 23.0.0 < /li>
Wir sind NICHT < /em> mit Docker. Diese Django-App wird direkt auf dem Server mit einer lokalen virtuellen Umgebung ausgeführt. Hier ist das Herz davon: < /p>
Code: Select all
with Image(filename=pdf_location) as pdf:
with Image(pdf.sequence[0]) as first_page_pdf:
with first_page_pdf.convert('png') as first_page_png:
first_page_png.background_color = Color('white')
first_page_png.alpha_channel = 'remove'
return first_page_png.make_blob()
< /code>
Wenn ich eine PDF zur Verarbeitung auf die Administratorseite hochladen, erhalte ich diesen Fehler: < /p>
MagickReadImage returns false, but did not raise ImageMagick exception. This can occur when a delegate is missing, or returns EXIT_SUCCESS without generating a raster.
- i do haben Ghostscript installiert:
Code: Select all
$ gs --version
10.02.1
$ which gs
/usr/bin/gs
- Meine imagemagicke Richtlinie.xml enthält den Standardinhalt in der Richtlinie-Debian.xml Datei, die mit dem Imagemagick-Paket enthalten ist, mit der bemerkenswerten Ausnahme, dass
Code: Select all
$ identify -list policy
Path: /etc/ImageMagick-6/policy.xml
Policy: Resource
name: disk
value: 2GiB
Policy: Resource
name: map
value: 2048MiB
Policy: Resource
name: memory
value: 1024MiB
Policy: Resource
name: area
value: 256MP
Policy: Resource
name: height
value: 32KP
Policy: Resource
name: width
value: 32KP
Policy: Undefined
rights: None
Policy: Path
rights: None
pattern: @*
Policy: Delegate
rights: None
pattern: URL
Policy: Delegate
rights: None
pattern: HTTPS
Policy: Delegate
rights: None
pattern: HTTP
Policy: Coder
rights: Read Write
pattern: PDF
Path: [built-in]
Policy: Undefined
rights: None
< /code>
Umwandlung derselben PDF -Datei funktioniert < /em>, wenn ich es sowohl mit Ghostscript als auch mit Imagemagick minuell mache (wie hier vorgeschlagen): < /li>
< /ul>
$ gs -sDEVICE=pngalpha -o page-%03d.png -r120 pdf-test.pdf
GPL Ghostscript 10.02.1 (2023-11-01)
Copyright (C) 2023 Artifex Software, Inc. All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
Processing pages 1 through 1.
Page 1
Loading font ArialMT (or substitute) from /usr/share/ghostscript/10.02.1/Resource/Font/NimbusSans-Regular
< /code>
und < /p>
$ convert -density 120 pdf-test.pdf page-%03d.png
< /code>
Beide erstellen beide korrekt. PrettyPrint-Override ">$ ./manage_dev.py shell
19 objects imported automatically (use -v 2 for details).
Python 3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from wand.image import Image, Color
>>> with Image(filename='pdf-test.pdf') as pdf:
... with Image(pdf.sequence[0]) as first_page_pdf:
... with first_page_pdf.convert('png') as first_page_png:
... first_page_png.background_color = Color('white')
... first_page_png.alpha_channel = 'remove'
... blob = first_page_png.make_blob()
... with open('screenshot.png', 'wb') as png:
... png.write(blob)
...
24420
< /code>
Eine Sache, die ein bisschen bizarr ist, ist, dass GS < /code> nicht aufgeführt ist, wenn ich die ImageMagick -Delegierten aufliste. Dies ist das einzige, was mir vorstellen kann, dass das [url=viewtopic.php?t=26065]Problem[/url] verursacht wird, aber ich kann nicht herausfinden, wie ich es auflisten kann: < /li>
< /ul>
$ convert -list configure | grep DELEGATES
DELEGATES bzlib djvu fftw fontconfig freetype heic jbig jng jpeg lcms lqr lzma openexr openjp2 pango png ps raw tiff webp wmf x xml zlib zstd
DELEGATES bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png raw tiff webp wmf x xml zlib
< /code>
Beachten Sie, dass dies kein Tippfehler ist; Hier gibt es 2 Delegierte
Danke im Voraus! Sollte ich? < /Li>
< /ul>
Code: Select all
$ convert -version
Version: ImageMagick 6.9.12-98 Q16 x86_64 18038 https://legacy.imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5)
Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png raw tiff webp wmf x xml zlib
< /code>
convert -list configure | grep pdf