forked from josch/img2pdf
do not overwrite dpi variable
This commit is contained in:
parent
46a510d2b9
commit
c76c63ab72
1 changed files with 9 additions and 9 deletions
18
img2pdf.py
18
img2pdf.py
|
@ -208,11 +208,11 @@ def main(images, dpi, title=None, author=None, creator=None, producer=None,
|
||||||
imgformat = "JP2"
|
imgformat = "JP2"
|
||||||
|
|
||||||
if dpi:
|
if dpi:
|
||||||
dpi = dpi, dpi
|
ndpi = dpi, dpi
|
||||||
debug_out("input dpi (forced) = %d x %d"%dpi)
|
debug_out("input dpi (forced) = %d x %d"%ndpi)
|
||||||
else:
|
else:
|
||||||
dpi = (96, 96) # TODO: read real dpi
|
ndpi = (96, 96) # TODO: read real dpi
|
||||||
debug_out("input dpi = %d x %d"%dpi)
|
debug_out("input dpi = %d x %d"%ndpi)
|
||||||
|
|
||||||
if colorspace:
|
if colorspace:
|
||||||
color = colorspace
|
color = colorspace
|
||||||
|
@ -225,11 +225,11 @@ def main(images, dpi, title=None, author=None, creator=None, producer=None,
|
||||||
imgformat = imgdata.format
|
imgformat = imgdata.format
|
||||||
|
|
||||||
if dpi:
|
if dpi:
|
||||||
dpi = dpi, dpi
|
ndpi = dpi, dpi
|
||||||
debug_out("input dpi (forced) = %d x %d"%dpi)
|
debug_out("input dpi (forced) = %d x %d"%ndpi)
|
||||||
else:
|
else:
|
||||||
dpi = imgdata.info.get("dpi", (96, 96))
|
ndpi = imgdata.info.get("dpi", (96, 96))
|
||||||
debug_out("input dpi = %d x %d"%dpi)
|
debug_out("input dpi = %d x %d"%ndpi)
|
||||||
|
|
||||||
if colorspace:
|
if colorspace:
|
||||||
color = colorspace
|
color = colorspace
|
||||||
|
@ -255,7 +255,7 @@ def main(images, dpi, title=None, author=None, creator=None, producer=None,
|
||||||
color = 'L'
|
color = 'L'
|
||||||
imgdata = zlib.compress(imgdata.tostring())
|
imgdata = zlib.compress(imgdata.tostring())
|
||||||
|
|
||||||
pdf.addimage(color, width, height, dpi, imgformat, imgdata)
|
pdf.addimage(color, width, height, ndpi, imgformat, imgdata)
|
||||||
|
|
||||||
im.close()
|
im.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue