Frank Breitling <fbreitling@...1017...> writes:
I am using the GTKAgg backend which was the only one I found with
support for JPEG.
I think that backend inherits its support from the GTK backend, which
uses GDK for saving JPEG files, and doesn't do anything with those
options.
I just realized that the Agg support depends on PIL. If you have that
installed, this script should produce a really low-quality JPEG file:
···
----------------------------------------------------------------------
#!/usr/bin/env python
import matplotlib
matplotlib.use('agg')
import pylab
pylab.plot([3,1,4,1,5,9,2], lw=4)
pylab.savefig('foo.jpeg', quality=1)
----------------------------------------------------------------------
Although the options quality='95' and quality=1 didn't produce an error
they didn't have any effect either on a Ubuntu system.
Is there anything else I could try?
If you do have PIL, you could use the non-interactive agg backend. If
you do need to use an interactive backend that doesn't have support for
these options, you could look at the implementation of
FigureCanvasBase.print_jpg and replicate its functionality.
Besides, it would be very useful to find these options in the
documentation or the help if there is a situation in which they work.
The options are documented, but it's not very easy to find them:
--
Jouni K. Sepp�nen