CaiJingLong / dart_image_size_getter

Use dart file api to get image size, needn't use decode. just read the metadata.
Apache License 2.0
64 stars 29 forks source link

Allow network input #5

Closed kobutri closed 2 years ago

kobutri commented 3 years ago

One of the most useful use cases for determining the image size without having to parse the entire image is when you load a big image over the network of unknown dimensions and want to determine the layout as early as possible.

The StreamedResponse of Dart's http library already provides a mechanism for accessing part of the data without having to wait for the entire response to be completed.

Unfortunately it is not possible to implement ImageInput on such a network image, because http works asynchronously. It would be really great if you could make the getRange method async and better yet create a NetworkInput class

esDotDev commented 3 years ago

Seconded, this would be really nice

Shiba-Kar commented 2 years ago

Ya I have a use case

CaiJingLong commented 2 years ago

Now, support http_input. Use image_size_getter_http_input and read document to use it.

In addition, AsyncImageInput has been customized, which can be customized according to requirements.