ocaml-imagelib icon indicating copy to clipboard operation
ocaml-imagelib copied to clipboard

Support progressive image rendering

Open cfcs opened this issue 7 years ago • 3 comments

Hi!

What do you think about adding support for progressive parsing/rendering?

Here is a demonstration: https://blog.codinghorror.com/progressive-image-rendering/

I'm mostly interested in the non-interlacing variant (due to memory consumption concerns), and it appears to me that would be fairly simple to implement for most of the formats, but it would require an API change (or extension).

I can try to come up with a PoC in a week or two if you are interested.

cfcs avatar Oct 30 '17 02:10 cfcs

I thought about that at some point, but is it really necessary given that the internet has now a reasonable speed mostly everywhere?

If you want to implement this, then go for it, but I'd like the current interface to remain the same as it fits my needs. :-)

rlepigre avatar Oct 30 '17 14:10 rlepigre

It's not so much about speed, it's more that a bitmap representation quickly ends up eating up a lot of ram, and since I'm dealing with unikernels that do not have dynamic memory allocation (or memory ballooning) I need to pre-allocate the maximum memory up front.

Here's a screenshot of the PNG renderer working as a Xen unikernel, and with an SDL target, btw: https://github.com/cfcs/eye-of-mirage/#latest-screenshot :)

Alright, I was thinking to add a chunk-based reader to the Image.mli ReadImage signature (defaulting to just being synonymous with parsefile at first), would that be OK?

cfcs avatar Oct 30 '17 14:10 cfcs

OK, I see. Alright then! ;)

rlepigre avatar Oct 30 '17 15:10 rlepigre