Hi mpl-users, I have a web application in which I produce png files using matplotlib. Unfortunately the files are quite big (up to ~300 kb). I have however tried using the Linux tool pngnq to reduce the file size with a factor ~3-4 with almost no degradation of the result. I therefore wondered whether it is possible to setup matplotlib to do something similar (from the source code the savefig method for png files does not seem to use any keyword arguments). Here is the output of the command pnginfo for the matplotlib output file and the pngnq processed file:
0.0.0.0.0.0.20090517t00z.768.png... Image Width: 768 Image Length: 328 Bitdepth (Bits/Sample): 8 Channels (Samples/Pixel): 4 Pixel depth (Pixel Depth): 32 Colour Type (Photometric Interpretation): RGB with alpha channel Image filter: Single row per byte filter Interlacing: No interlacing Compression Scheme: Deflate method 8, 32k window Resolution: 5039, 5039 (pixels per meter) FillOrder: msb-to-lsb Byte Order: Network (Big Endian) Number of text strings: 0 of 0 Offsets: 0, 0 0.0.0.0.0.0.20090517t00z.768-nq8.png... Image Width: 768 Image Length: 328 Bitdepth (Bits/Sample): 8 Channels (Samples/Pixel): 1 Pixel depth (Pixel Depth): 8 Colour Type (Photometric Interpretation): PALETTED COLOUR (256 colours, 0 transparent) Image filter: Single row per byte filter Interlacing: No interlacing Compression Scheme: Deflate method 8, 32k window Resolution: 0, 0 (unit unknown) FillOrder: msb-to-lsb Byte Order: Network (Big Endian) Number of text strings: 0 of 0 Offsets: 0, 0 I am not using transparency for anything. For a web application a reduction from 300 kb to 90 kb is really important so I hope you have some good ideas. Otherwise I guess I will have to put in a call to pngnq in my code (although I prefer to avoid calls to external programs in the Python code when possible). Best regards, Jesper ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users