Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Return the image type #34

Open
bramp opened this issue Aug 8, 2023 · 2 comments
Open

[Feature request] Return the image type #34

bramp opened this issue Aug 8, 2023 · 2 comments
Labels
Type: enhancement New feature or request

Comments

@bramp
Copy link

bramp commented Aug 8, 2023

Platforms

dart

Description

In addition to returning a size, it would be useful to return the image type (PNG, JPG, etc).

The implementation of ImageSizeGetter.getSize seems to cycle though each image format, to check if it's a valid image, and then return the size for the first valid one. It would be useful to also return the image type, so this can be used by the caller.

Why

To validate the image is the expected file format, or to just determine the file format.

@CaiJingLong
Copy link
Member

Sorry for the long time no reply.
The problem is, images come in many formats, and the library provides custom decoders, so I can't predict all types.
In this case, I can't use enumerations to define all image types, and using string I can't enjoy strong typing when using.

@CaiJingLong CaiJingLong added the Type: enhancement New feature or request label Oct 10, 2024
@bramp
Copy link
Author

bramp commented Oct 10, 2024

To clarify, the change is just to return the name of the file type when returning a valid size.

So changing https://github.com/CaiJingLong/dart_image_size_getter/blob/ef9d71e301c002d0a20bf622a176828db2e82f2f/packages/image_size_getter/lib/src/image_size_getter.dart#L120 to return value.decoderName in addition to the result of getSize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants