system infomation
$ uname -a
Linux VM_64_3_centos 3.10.0-1160.11.1.el7.x86_64 #1 SMP Fri Dec 18 16:34:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ yum install GraphicsMagick
$ yum install ghostscript
$ gm -help
GraphicsMagick 1.3.38 2022-03-26 Q16 http://www.GraphicsMagick.org/
Copyright (C) 2002-2022 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.
Usage: gm help command [options ...]
Where commands include:
animate - animate a sequence of images
batch - issue multiple commands in interactive or batch mode
benchmark - benchmark one of the other commands
compare - compare two images
composite - composite images together
conjure - execute a Magick Scripting Language (MSL) XML script
convert - convert an image or sequence of images
display - display an image on a workstation running X
help - obtain usage message for named command
identify - describe an image or image sequence
import - capture an application or X server screen
mogrify - transform an image or sequence of images
montage - create a composite image (in a grid) from separate images
time - time one of the other commands
version - obtain release version
$ convert -version
Version: ImageMagick 6.9.10-68 Q16 x86_64 2024-01-12 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(3.1)
Delegates (built-in): bzlib cairo fontconfig freetype gslib jng jp2 jpeg lcms ltdl lzma openexr pangocairo png ps rsvg tiff wmf x xml zlib
Codes
import { fromBuffer } from "pdf2pic";
const pdfFile = '3b91b401-cab8-4b0e-9b73-5a9281910de4.pdf';
const pdfBuffer = fs.readFileSync(pdfPath);
const convert = fromBuffer(pdfBuffer, {
density: 300,
format: "png",
width: 2481 / 2,
height: 3508 / 2,
saveFilename: "untitled",
savePath: path.resolve('./saved-images'),
});
const resolves = await convert.bulk(-1, { responseType: "image" });
result image

system infomation
Codes
result image
