Roughsketch / imagesize

Quickly probe the size of various image formats without reading the entire file.
MIT License
57 stars 12 forks source link

Distinguish between HEIF and HEIC #34

Closed rsuu closed 2 months ago

rsuu commented 3 months ago

Now, return Avif for .avif and Heic for .heic/heif.

virtualritz commented 2 months ago

This fails CI because of #35. I.e. it's unrelated to the PR.

Roughsketch commented 2 months ago

Thanks for the PR, I'll try to review it later when I have time.

My main thought at the moment without reviewing is what is the use case for this change? I don't know if having 2 return values for HEIF and HEIC is helpful.

rsuu commented 2 months ago

That because image_type() is now always return Heif on .heic and .avif.

match ... {
    // before 
    // failed: because HEIF is unsupported by image crate
    ImageType::Heif => image::open( .avif or .heic ),

    // after
    ImageType::Heic => heic::open(),
    ImageType::Avif => image::open(),
}
Roughsketch commented 2 months ago

Thanks, that makes sense to me.

Initial pass seems probably fine, but I want to take some time to do a code style pass and probably run a fuzzer on it to make sure there aren't any obvious edge cases.

virtualritz commented 2 months ago

We use imagesize for a file transfer tool with UI. We want to display the right icon for each file type and we do have different icons for HEIF and HEIC.

I.e. for us this would be cool to have, even though we're not connected to this PR.