[Mediawiki-l] Generate (rendering) PNG files from SVG file

Brion Vibber brion at pobox.com
Mon May 23 21:20:30 UTC 2011


On Mon, May 23, 2011 at 2:12 PM, Danny <danny373 at gmail.com> wrote:

> Hi!
> I'm a big fan of the MediaWiki project. I have my own, little Wiki on
> the MediaWiki engine. I wonder how do you generate the PNG files in
> various resolutions from one SVG file?
>
> For example, on the http://en.wikipedia.org/wiki/File:SVG-logo.svg
> page where there is such a line: "This image rendered as PNG in other
> sizes: 200px, 500px, 1000px, 2000px." When I click on the link XXXps,
> Wikipedia generates a PNG file with XXXpx resolution. This is great!
> But I'm curious:
> A) Do you generate a PNG file on the fly? And how are you doing it?
> B) Or rather, preparing a PNG files before? For example, using a
> script, bot or something else.
>

SVG rasterization to PNG images is handled roughly the same way as
thumbnailing of PNG, GIF, and JPEG images -- depending on the server
settings, the transformed thumbnail file is created either at parse time (on
demand when requested by a wiki page) or other reference (eg, when
referenced from an API request for a thumbnail of a particular size) or that
may be deferred until a custom-configured HTTP 404 handler falls through and
requests the file to be generated on the fly and then stored.

See:
* http://www.mediawiki.org/wiki/SVG
* http://www.mediawiki.org/wiki/Manual:Image_Administration

-- brion vibber (brion @ pobox.com / brion @ wikimedia.org)


More information about the MediaWiki-l mailing list