Skip to content

Random crash during batch PDF to PNG conversion #415

@YulongNiu

Description

@YulongNiu

I would like to report an unexpected crash that occurs during the conversion of PDFs to PNGs. I have approximately 100 single-image PDF files, and the conversion process crashes unpredictably during the for loop iteration. I have manually verified that each PDF can be successfully converted to a PNG using the same code when run individually. The relevant code block is as follows:

for (i in PDFs) {
  eachPdf <- image_read_pdf(i, density = 300)
  eachPngPath <- ...
  image_write(eachPdf, path = eachPngPath, format = "png")
}

Error messages:

R: ../../magick/image.c:2285: ResetImagePixels: Assertion `image != (Image *) NULL' failed.
Aborted

sessionInfo:

> sessionInfo()
R version 4.5.1 (2025-06-13)
Platform: x86_64-pc-linux-gnu
Running under: Debian GNU/Linux 12 (bookworm)

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.11.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.11.0  LAPACK version 3.11.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: Europe/Copenhagen
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] magick_2.8.7

loaded via a namespace (and not attached):
[1] compiler_4.5.1 magrittr_2.0.3 Rcpp_1.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions