Compare commits
No commits in common. "9e2984bb62067f31ddc6b9367d06d037a4f66d93" and "7678435eb7d246236ab045bb55d4f27d4b1fb878" have entirely different histories.
9e2984bb62
...
7678435eb7
2 changed files with 3 additions and 53 deletions
39
HACKING
39
HACKING
|
@ -27,41 +27,6 @@ Making a new release
|
||||||
|
|
||||||
- Build and upload to pypi:
|
- Build and upload to pypi:
|
||||||
|
|
||||||
$ rm -rf dist/*
|
$ rm dist/*
|
||||||
$ python3 setup.py sdist
|
$ python3 setup.py sdist
|
||||||
$ twine upload dist/*
|
$ twine upload --sign dist/*
|
||||||
|
|
||||||
Using debbisect to find regressions
|
|
||||||
-----------------------------------
|
|
||||||
|
|
||||||
$ debbisect --cache=./cache --depends="git,ca-certificates,python3,
|
|
||||||
ghostscript,imagemagick,mupdf-tools,poppler-utils,python3-pil,
|
|
||||||
python3-pytest,python3-numpy,python3-scipy,python3-pikepdf" \
|
|
||||||
--verbose 2023-09-16 2023-10-24 \
|
|
||||||
'chroot "$1" sh -c "
|
|
||||||
git clone https://gitlab.mister-muffin.de/josch/img2pdf.git
|
|
||||||
&& cd img2pdf
|
|
||||||
&& pytest 'src/img2pdf_test.py::test_jpg_2000_rgba8[internal]"'
|
|
||||||
|
|
||||||
Using debbisect cache
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
$ mmdebstrap --variant=apt --aptopt='Acquire::Check-Valid-Until "false"' \
|
|
||||||
--include=git,ca-certificates,python3,ghostscript,imagemagick \
|
|
||||||
--include=mupdf-tools,poppler-utils,python3-pil,python3-pytest \
|
|
||||||
--include=python3-numpy,python3-scipy,python3-pikepdf \
|
|
||||||
--hook-dir=/usr/share/mmdebstrap/hooks/file-mirror-automount \
|
|
||||||
--setup-hook='mkdir -p "$1/home/josch/git/devscripts/cache/pool/"' \
|
|
||||||
--setup-hook='mount -o ro,bind /home/josch/git/devscripts/cache/pool/ "$1/home/josch/git/devscripts/cache/pool/"' \
|
|
||||||
--chrooted-customize-hook=bash
|
|
||||||
unstable /dev/null
|
|
||||||
file:///home/josch/git/devscripts/cache/archive/debian/20231022T090139Z/
|
|
||||||
|
|
||||||
Bisecting imagemagick
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
$ git clean -fdx && git reset --hard
|
|
||||||
$ ./configure --prefix=$(pwd)/prefix
|
|
||||||
$ make -j$(nproc)
|
|
||||||
$ make install
|
|
||||||
$ LD_LIBRARY_PATH=$(pwd)/prefix/lib prefix/bin/compare ...
|
|
||||||
|
|
|
@ -1311,22 +1311,7 @@ def get_imgmetadata(
|
||||||
else:
|
else:
|
||||||
imgwidthpx, imgheightpx = imgdata.size
|
imgwidthpx, imgheightpx = imgdata.size
|
||||||
|
|
||||||
ndpi = imgdata.info.get("dpi")
|
ndpi = imgdata.info.get("dpi", (default_dpi, default_dpi))
|
||||||
# the PNG plugin of PIL adds the undocumented "aspect" field instead of
|
|
||||||
# the "dpi" field if the PNG pHYs chunk unit is not set to meters
|
|
||||||
if (
|
|
||||||
ndpi is None
|
|
||||||
and imgformat == ImageFormat.PNG
|
|
||||||
and imgdata.info.get("aspect") is not None
|
|
||||||
):
|
|
||||||
aspect = imgdata.info["aspect"]
|
|
||||||
# make sure not to go below the default dpi
|
|
||||||
if aspect[0] > aspect[1]:
|
|
||||||
ndpi = (default_dpi * aspect[0] / aspect[1], default_dpi)
|
|
||||||
else:
|
|
||||||
ndpi = (default_dpi, default_dpi * aspect[1] / aspect[0])
|
|
||||||
else:
|
|
||||||
ndpi = (default_dpi, default_dpi)
|
|
||||||
# In python3, the returned dpi value for some tiff images will
|
# In python3, the returned dpi value for some tiff images will
|
||||||
# not be an integer but a float. To make the behaviour of
|
# not be an integer but a float. To make the behaviour of
|
||||||
# img2pdf the same between python2 and python3, we convert that
|
# img2pdf the same between python2 and python3, we convert that
|
||||||
|
|
Loading…
Reference in a new issue