yakovmeister / pdf2image

A utility for converting pdf to image and base64 format.
MIT License
435 stars 141 forks source link

Density option is broken. #162

Closed Zirafnik closed 1 year ago

Zirafnik commented 1 year ago

Density option has no effect on the final result.

I have flied through the library code and at first glance it seems that the problem is not on 'pdf2pic' end, as all the gm calls seem to be okay.

But none of the dependencies upstream report this issue. Not the node gm library we are using, and not the GraphicsMagick itself.

It would be great if somebody could test the gm dependency alone, and see if the problem is coming from there. If density works in gm, then the problem lies here.

Zirafnik commented 1 year ago

I have tested the 'PDF2Pic' library manually, by inserting higher values, when setting gm settings, directly in the code.

public gmBaseCommand(stream: fs.ReadStream, filename: string): gm.State {
    return this.gm(stream, filename)
      .density(300, 300) // 300, instead of default 72
      ...

Unfortunatelly, still no luck. It appears the gm dependency or upwards must be broken.

mskec commented 1 year ago

Hi @Zirafnik,

I tested different density options and I can see difference in the output. Here is my test file https://github.com/mskec/pdf2image/commit/161e7c834c4627f0e3372d57b7a414e5a8d5ed04 I have gm@1.23.1.

mskec commented 1 year ago

I'll close the issue. Feel free to submit more info if you think the problem is in pdf2pic.