Skip to content

.ico coder needs magic number detection (coders/icon.c) #4230

@gurgeous

Description

@gurgeous

Is your feature request related to a problem? Please describe.

The ICO coder lacks magic number detection. You can see this behavior on the command line. These two files are identical:

$ identify favicon.bogus favicon.ico
favicon.ico[0] ICO 48x48 48x48+0+0 8-bit sRGB 0.000u 0:00.001
identify: no decode delegate for this image format `BOGUS' @ error/constitute.c/ReadImage/575.

The real problem is when favicons are loaded from the network using the various API bindings. For example, with the go bindings you have to save the .ICO to a temp file and load it that way. Similar shenanigans are required for the ruby bindings.

Describe the solution you'd like

Add magic number to the coder. I think the two magic numbers are 00 00 01 00 (ICO) and 00 00 02 00 (CUR).

Thanks for all your hard work on ImageMagick, we use it regularly!

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions