ResourceLoaderImage::rasterize added for T76473: Implement ResourceLoader module to ship CSS for sets of SVG+PNG icons to the user bears the following comment:
// This code should be factored out to a separate method on SvgHandler, or perhaps a separate // class, with a separate set of configuration settings. // // This is a distinct use case from regular SVG rasterization: // * we can skip many sanity and security checks (as the images come from a trusted source, // rather than from the user) // * we need to provide extra options to some converters to achieve acceptable quality for very // small images, which might cause performance issues in the general case // * we need to directly pass image data to the converter instead of a file path // // See https://phabricator.wikimedia.org/T76473#801446 for examples of what happens with the // default settings. // // For now, we special-case rsvg (used in WMF production) and do a messy workaround for other // converters.