dpi and pdfa convertion do not reflect #98

Closed
opened 2021-05-06 09:33:02 +00:00 by SnukY · 4 comments

Hi there,

I am using a list in a python script to create multiple pdfs

dpi = 300
with open('pdf/'+workitemid+'_'+filenames+'_'+nextpage+'.pdf', "wb") as m:
	m.write(img2pdf.convert(document, dpi=dpi, x=None, y=None, pdfa=None))

changing the dpi does not reflect any changes in the output and using pdfa also does not convert it to a pdfa format.

I am not sure if this is not supported to use like this or if it is not working.

The scripts otherwise works fine and does what is should do convert multiple picture files tiff & jpgs to pdf.

Hi there, I am using a list in a python script to create multiple pdfs ``` dpi = 300 with open('pdf/'+workitemid+'_'+filenames+'_'+nextpage+'.pdf', "wb") as m: m.write(img2pdf.convert(document, dpi=dpi, x=None, y=None, pdfa=None)) ``` changing the dpi does not reflect any changes in the output and using pdfa also does not convert it to a pdfa format. I am not sure if this is not supported to use like this or if it is not working. The scripts otherwise works fine and does what is should do convert multiple picture files tiff & jpgs to pdf.
Owner

This should indeed be fixed in the docs. Until it is the solution to setting the dpi is to pass a different layout function. Since changing the dpi is a common task, img2pdf brings a handy wrapper that you can use like this:

layout_fun = img2pdf.get_fixed_dpi_layout_fun((300, 300))
img2pdf.convert(image1, layout_fun=layout_fun, ... )

The pdfa argument expects the path to an icc profile. So you have to call convert like this:

img2pdf.convert(..., pdfa="/usr/share/color/icc/sRGB.icc", ...)
This should indeed be fixed in the docs. Until it is the solution to setting the dpi is to pass a different layout function. Since changing the dpi is a common task, img2pdf brings a handy wrapper that you can use like this: layout_fun = img2pdf.get_fixed_dpi_layout_fun((300, 300)) img2pdf.convert(image1, layout_fun=layout_fun, ... ) The pdfa argument expects the path to an icc profile. So you have to call `convert` like this: img2pdf.convert(..., pdfa="/usr/share/color/icc/sRGB.icc", ...)
Author

Thanks a lot for the fast response. I just tried to set the dpi as suggested. Script still working but the size of the pdf does not change.
I'm pretty new to converting files but shouldn't it lower the quality with lower dpi and the file should become smaller? (tried 50,50 150,150 300,300 600,600)

About the pdfa, thanks I will look into that.

Thanks a lot for the fast response. I just tried to set the dpi as suggested. Script still working but the size of the pdf does not change. I'm pretty new to converting files but shouldn't it lower the quality with lower dpi and the file should become smaller? (tried 50,50 150,150 300,300 600,600) About the pdfa, thanks I will look into that.
Owner

Consult the README. img2pdf is always lossless and refuses to work if it cannot do its job without loss of information. This means that the size is the same independent of the dpi. The dpi value only influences the page size (as in cm).

Consult the README. img2pdf is always lossless and refuses to work if it cannot do its job without loss of information. This means that the size is the same independent of the dpi. The dpi value only influences the page size (as in cm).
Author

ah okay, very nice.
PDFA is working too with providing an icc profile.

Thanks, solved for me then.

ah okay, very nice. PDFA is working too with providing an icc profile. Thanks, solved for me then.
josch closed this issue 2021-05-07 09:21:00 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: josch/img2pdf#98
No description provided.