I have some TikZ/PGF graphics which are being published both as a PDF and as web graphics. The diagrams themselves have transparent backgrounds, but wind up opaque thanks to pdfdraw's PNM-P6 output. Did some refactoring and added the code this morning. The following patches work for me with a variety of PDF samples (on Ubuntu hardy, libpng12). Source should be portable, but LINKLIBS will need tweaking for Windows. Encountered a glitch where rendertreeover seems to blend with the transparent background. Have not actually read the fitz API, so this could be expected. Patches are against Nov 20 03:57:46 EST 2009.
Created attachment 5699 [details] pdfdraw-1-extensions.patch pdfdraw: tweaked extension recognition and added detection for future output formats.
Created attachment 5700 [details] pdfdraw-2-refactor.patch pdfdraw: extracted more generic drawgraphics routine from drawpnm.
Created attachment 5701 [details] pdfdraw-3-libpng.patch pdfdraw: added PNG output support, with transparent backgrounds. Converted file output to stdio, since libpng supports it natively. As a result, the mode of created output files is no longer masked to 0666.
Thanks, but MuPDF does not need yet another library dependency. We use pnmtopng if we want PNG output from pdfdraw.
Same as I was using previous to needing alpha support. You could probably add P7 support to get alpha support without the library dep. For my purposes needing netpbm is more annoying than libpng, so will stick with the patched version. Had not noticed that you folks do commercial licensing on the side. As such, those patches are useless for you anyway. Sorry about that.
We generally use PNM files internally for regression testing and such, but adding P7 support as well as grayscale output is definitely worth considering.
Having alpha output (either pngalph or P7) is definitely worth having and is critical for some applications. I think this is part of fleshing out mupdf as a useful tool. Reopening as an enhancemnt request.
The rewritten pdfdraw tool now provides both PAM and PNG output, with or without alpha channel. If you ask for output with an alpha channel, the page background will be transparent instead of white.