Remove interlace output

27 views
Skip to first unread message

David Jones

unread,
Apr 8, 2024, 8:44:15 AM4/8/24
to pypng...@googlegroups.com
PyPNG https://gitlab.com/drj11/pypng is quite big. I have been
thinking about ways to make it smaller.

One easy way that would make it a bit smaller is to remove the
interlace option on output. Any objections?

Cheers,
drj

Ilya Razmanov

unread,
Apr 22, 2024, 2:11:27 AM4/22/24
to PyPNG Users
Not a single one from me so far. All I need from this module regarding writing PNGs is PNG being formally correct, contain proper iDAT (alpha included), sometimes pHYs, in future may be gAMA. Other than that, if I need PNG to be optimized for size, be interlaced, and so on, I have other software to do that.

David Jones

unread,
Apr 23, 2024, 2:30:09 PM4/23/24
to pypng...@googlegroups.com
Thanks for the reply. Actually, great to hear that someone is using
pHYs and gAMA. :)

Cheers,
drj
> --
> You received this message because you are subscribed to the Google Groups "PyPNG Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pypng-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pypng-users/20c126a1-73b0-4f62-823c-b909089130ebn%40googlegroups.com.

Ilya Razmanov

unread,
Apr 24, 2024, 3:03:33 AM4/24/24
to PyPNG Users
On Tuesday, April 23, 2024 at 9:30:09 PM UTC+3 David wrote:
Thanks for the reply. Actually, great to hear that someone is using
pHYs and gAMA. :)

Actually, great to hear that someone is using
pHYs and gAMA. :)


One example:


(sorry, there's a kind of mess in here while I'm adding multiprocessing) - an example of efficient misuse of Scale2x and Scale3x algorithms to improve scans with "historically poor" resolution before OCR and stuff. For IO, surely I'm using your PNG module (since I managed to understand how to deal with it there's no way I will deal with Pillow, full with features I don't need, and having it's own opinion on how data should look).
With low-res scans, OCR software tend to complain, and I found out that, say, Scale3x with its unusual interpolation often makes an improvements in OCR, so I've made these pure Python implementations of ScaleNx, to use them from time to time.

My OCR software uses input image resolution to assign page size. Therefore, it would be very convenient if, scaling images up with Scale2x, I will double the resolution (and triple for Scale3x) so it keeps original print size in meters and precisely fit the old page layout.

With your PNG module, I easily do that, with just several lines of code. Programs are happy to see new resolution, I'm happy that I don't have to set it manually, everything is fine.

-- 
Ilyich the Toad
https://dnyarri.github.io/
Reply all
Reply to author
Forward
0 new messages