JetBrains / skiko

Kotlin Multiplatform bindings to Skia
Apache License 2.0
1.83k stars 118 forks source link

Support decoding Image from a streaming data source #741

Closed colinrtwhite closed 1 month ago

colinrtwhite commented 1 year ago

Hi, I was wondering if it's possible to support streaming image data when decoding an Image. At the moment it looks like Image only has methods to decode the image when its data is already all in memory (e.g. ByteArray, Pixmap). This requires consumers to buffer the entire image data into memory before decoding, which isn't ideal for performance.

I'd be nice to support an InputStream-like primitive (can be a custom type) so that users can decode Images without totally reading them into memory first. This would be especially useful for decoding from Files.

It looks Skia already has support for streams that could hopefully be leveraged. Thanks for the great library!

revonateB0T commented 10 months ago

I guess this will land with kotlinx-io support as base or extensions?

okushnikov commented 1 month ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.