]> source.dussan.org Git - gitea.git/commit
Downscale pasted PNG images based on metadata (#29123)
authorsilverwind <me@silverwind.io>
Mon, 19 Feb 2024 02:23:06 +0000 (03:23 +0100)
committerGitHub <noreply@github.com>
Mon, 19 Feb 2024 02:23:06 +0000 (02:23 +0000)
commit5e72526da4e915791f03af056890e16821bde052
tree762911ed77e32ecc3e94872b6959442ae025332e
parentf04e71f9bc05d4930e1eff0b69ceb0e890528e30
Downscale pasted PNG images based on metadata (#29123)

Some images like MacOS screenshots contain
[pHYs](http://www.libpng.org/pub/png/book/chapter11.html#png.ch11.div.8)
data which we can use to downscale uploaded images so they render in the
same dppx ratio in which they were taken.

Before:

<img width="584" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/50979e3a-5d5a-40dc-a0a4-36eb6e28f14a">

After:

<img width="329" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/0690902a-f2fe-4c6b-97b3-6fdd67c21bad">
web_src/js/features/comp/ImagePaste.js
web_src/js/utils/image.js [new file with mode: 0644]
web_src/js/utils/image.test.js [new file with mode: 0644]