image-rs / image

Encoding and decoding images in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

alpha mask check in ico files

cyberpunkbln opened this issue · comments

Hello,

I have the same problem like the user in #1590. Some ico extracted from an exe has an rgb8 format without alpha channel. I want only extract the png from this ico-file.

I load the ico with the method image::open ("bad_ico.ico") but i have only the option for imageresult ok() or err().

Is it possible to extract that rgb8-png with the current version? some trick? When not can you implement this from the #1590?

thx

If you just need to decode that one image, you can always fork the code and use it get an extracted version from the file.

However, there's a higher bar for changing the code for everyone. We generally want to reject image files that other decoders consider to be corrupt. So to eliminate the check, we'd either need to find evidence that ICOs with embedded RGB PNGs are actually valid according to some relevant spec or that other mainstream decoders already accept them.

@fintelia I checked my whole process and i have seen that when i extract the ico from exe i must check if the png is present and then use the rgb8-png to extract and give it to my piece of code as image to convert. The image-lib recognize the type automaticly. For ico-files directly i parse the icondir in the future and think i test the image-format.