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

width and height in WebPData? #43

Open
recsater opened this issue Aug 18, 2023 · 3 comments
Open

width and height in WebPData? #43

recsater opened this issue Aug 18, 2023 · 3 comments

Comments

@recsater
Copy link

How about putting width, height information in WebPData?

Actually I think it's actually possible and ideal to get width and height after the next code.

webp_data = webp.WebPData.from_buffer(item)
https://developers.google.com/speed/webp/docs/api?hl=ko#simple_decoding_api

@anibali
Copy link
Owner

anibali commented Aug 18, 2023

Are you asking for a way to determine width and height directly from a WebPData instance?

You can currently do this like so:

dec_config = WebPDecoderConfig.new()
dec_config.read_features(my_webp_data)
print(dec_config.input.height, dec_config.input.width)

I'm not sure that using WebPGetInfo would give a significant speed improvement over the above approach. I suppose it would be possible to add helper functions for retrieving the width and height directly from a WebPData instance, but it doesn't seem critical.

@recsater
Copy link
Author

recsater commented Aug 18, 2023

In a way that is not neat, it is possible as follows.

dep_config = webp.WebPDecoderConfig.new()
dep_config.read_features(webp_data)

width = dep_config.input.width
height = dep_config.input.height

I think it would be nice if this existed as a member variable.

@anibali
Copy link
Owner

anibali commented Aug 18, 2023

I understand your point, but hopefully this is a good enough workaround for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants