-
Notifications
You must be signed in to change notification settings - Fork 688
Description
PR #2372 added decoding hooks, so a third-party format implementation can be registered as a plugin and work through all the usual facilities in an abstract way.
It also added a Format enum that lets image refer to these plugin formats:
image/src/io/image_reader_type.rs
Lines 14 to 18 in 1ed88e4
| #[derive(Clone)] | |
| enum Format { | |
| BuiltIn(ImageFormat), | |
| Extension(OsString), | |
| } |
However, that enum is private.
In wondermagick I keep running into the need to name formats, including plugin formats. For example, the input can be prefixed with a format modifier, e.g. webp:some_file, that specifies what format "some_file" should be treated as. There's Decoder::set_format that allows precisely that, but it accepts ImageFormat enum that can only represents built-in formats, not the ones registered via plugins.
Draft
I think the best way is going to be to just another variant to ImageFormat to represent third-party plugins, in the same way as the private Format does today, and retire the private Format afterwards.