lumeland / imagemagick-deno

Deno port of the WASM library for ImageMagick
https://deno.land/x/imagemagick_deno
Apache License 2.0
44 stars 3 forks source link

Does it works for PDF files too? #12

Open JulienLecoq opened 1 year ago

JulienLecoq commented 1 year ago

I'm trying to read a PDF file and every time I try, I get this error:

error: Uncaught (in promise) Error: FailedToExecuteCommand `'gs' -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBi
ts=4 -dGraphicsAlphaBits=4 '-r72x72' -dPrinted=false  '-sOutputFile=/tmp/magick-BpJ_DS4NDVs4hz7B32Q9WkfPVnJmPJFN%d' '-f/tmp/magick-HFgrZ0nlH_Dk1jSFaGrtegMHXkiNiFiL' '-f/tmp/magick-o0WiEnqt2l8LP2WfTIMApk1OJ0GdhmNd''
 (-1) @ error/delegate.c/ExternalDelegateCommand/520
    const error = new MagickError(errorMessage, severity);
                  ^
    at Function.createError (https://deno.land/x/imagemagick_deno@0.0.26/src/internal/exception/exception.ts:105:19)
    at Function.throw (https://deno.land/x/imagemagick_deno@0.0.26/src/internal/exception/exception.ts:93:29)
    at Function.checkException (https://deno.land/x/imagemagick_deno@0.0.26/src/internal/exception/exception.ts:62:22)
    at https://deno.land/x/imagemagick_deno@0.0.26/src/internal/exception/exception.ts:48:24
    at Function.use (https://deno.land/x/imagemagick_deno@0.0.26/src/internal/pointer/pointer.ts:27:14)
    at Function.use (https://deno.land/x/imagemagick_deno@0.0.26/src/internal/exception/exception.ts:45:20)
    at MagickImage.readOrPing (https://deno.land/x/imagemagick_deno@0.0.26/src/magick-image.ts:2693:15)
    at MagickImage.read (https://deno.land/x/imagemagick_deno@0.0.26/src/magick-image.ts:2064:10)
    at https://deno.land/x/imagemagick_deno@0.0.26/src/image-magick.ts:207:17
    at Function._disposeAfterExecution (https://deno.land/x/imagemagick_deno@0.0.26/src/internal/disposable.ts:20:22)

If I do the same with a JPEG image, it works perfectly and I don't get any error.

oscarotero commented 1 year ago

You should ask to the original author: https://github.com/dlemstra/magick-wasm This code is just a port to make it working on Deno. But it doesn't support SVG formats so I guess PDF neither.