From Wikitech

Our custom DjVu engine leverages the ddjvu utility. Like all multipage engines we have, it is used in combination with the page filter, which simply passes the requested page number to the engine.

The DjVu engine uses a PPM file as an intermediary file to pass to our Imagemagick engine, which is uncompressed bitmap. The reason for that is to ensure the best quality possible. If memory consumption becomes an issue for some files, we could potentially use the compressed TIFF option in ddjvu which uses JPEG compression inside a TIFF container.