README.md: add more examples (closes: #98)

This commit is contained in:
Johannes Schauer Marin Rodrigues 2021-05-07 11:20:47 +02:00
parent ea2245757f
commit 80d24a1d49
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -199,6 +199,16 @@ The package can also be used as a library:
with open("name.pdf","wb") as f: with open("name.pdf","wb") as f:
f.write(img2pdf.convert('test.jpg', layout_fun=layout_fun)) f.write(img2pdf.convert('test.jpg', layout_fun=layout_fun))
# use a fixed dpi of 300 instead of reading it from the image
dpix = dpiy = 300
layout_fun = img2pdf.get_fixed_dpi_layout_fun((dpix, dpiy))
with open("name.pdf","wb") as f:
f.write(img2pdf.convert('test.jpg', layout_fun=layout_fun))
# create a PDF/A-1b compliant document by passing an ICC profile
with open("name.pdf","wb") as f:
f.write(img2pdf.convert('test.jpg', pdfa="/usr/share/color/icc/sRGB.icc"))
Comparison to ImageMagick Comparison to ImageMagick
------------------------- -------------------------