Change JPG compression ratio in savefig

When saving a figure in JPEG format *via the agg backend*, the following
extra keyword arguments have an effect:

            *quality*: The image quality, on a scale from 1 (worst) to
                95 (best). The default is 75. Values above 95 should
                be avoided; 100 completely disables the JPEG
                quantization stage.

            *optimize*: If present, indicates that the encoder should
                make an extra pass over the image in order to select
                optimal encoder settings.

            *progressive*: If present, indicates that this image
                should be stored as a progressive JPEG file.

If a backend implements its JPEG saving differently, these might not do
anything -- this seems to be the case for the MacOSX backend, for
example.

Frank Breitling <fbreitling@...1017...> writes:

···

Dear developers,

Since I can't reach the SF tracker, I send my feature request for a
JPG compression switch with savefig to the developer list.
Details follow below.
I hope you can help.

Cheers

Frank

-------- Original-Nachricht --------
Betreff: Re: [Matplotlib-users] Change JPG compression ratio in savefig
Datum: Tue, 06 Sep 2011 10:33:53 +0200
Von: Frank Breitling <fbreitling@...1017...>
Organisation: Leibniz-Institut f�r Astrophysik Potsdam (AIP)
An: Jeffrey Spencer <jeffspencerd@...149...>

Jeff, thanks for the hint.
But I really want to reduce the compression.
I would like to write a feature request, but the link to the tracker
(http://sourceforge.net/tracker2/?group_id=80706) at
http://matplotlib.sourceforge.net/ gave me "Error - The Tracker has been
disabled for this group".
Should I send my request through the developer list?

Cheers

Frank

Am 05.09.2011 20:15, schrieb Jeffrey Spencer:

You can use dpi=600 as a parameter to increase the resolution but I'm
not sure if that's what you mean. If you mean the actual compression
strategy used like to Jpeg2000 per se. Might have to do that after
saving the file with an image library (for example, PIL).

Cheers,
Jeff

On 09/06/2011 03:21 AM, Frank Breitling wrote:

Hi,

I am using matplotlib.savefig to save my figures as JPEG files.
Now I need to reduce the JPG compression ratio.
How can I do this?

Any hint is appreciated.

Frank

------------------------------------------------------------------------------

Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

--
Jouni K. Sepp�nen

Dear Jouni,

Thank you very much for your reply.
I am using the GTKAgg backend which was the only one I found with support for JPEG.
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?

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.

Frank

···

Am 06.09.2011 15:41, schrieb Jouni K. Sepp�nen:

When saving a figure in JPEG format *via the agg backend*, the following
extra keyword arguments have an effect:

             *quality*: The image quality, on a scale from 1 (worst) to
                 95 (best). The default is 75. Values above 95 should
                 be avoided; 100 completely disables the JPEG
                 quantization stage.

             *optimize*: If present, indicates that the encoder should
                 make an extra pass over the image in order to select
                 optimal encoder settings.

             *progressive*: If present, indicates that this image
                 should be stored as a progressive JPEG file.

If a backend implements its JPEG saving differently, these might not do
anything -- this seems to be the case for the MacOSX backend, for
example.

Frank Breitling<fbreitling@...1017...> writes:

Dear developers,

Since I can't reach the SF tracker, I send my feature request for a
JPG compression switch with savefig to the developer list.
Details follow below.
I hope you can help.

Cheers

Frank

-------- Original-Nachricht --------
Betreff: Re: [Matplotlib-users] Change JPG compression ratio in savefig
Datum: Tue, 06 Sep 2011 10:33:53 +0200
Von: Frank Breitling<fbreitling@...1017...>
Organisation: Leibniz-Institut f�r Astrophysik Potsdam (AIP)
An: Jeffrey Spencer<jeffspencerd@...149...>

Jeff, thanks for the hint.
But I really want to reduce the compression.
I would like to write a feature request, but the link to the tracker
(http://sourceforge.net/tracker2/?group_id=80706) at
http://matplotlib.sourceforge.net/ gave me "Error - The Tracker has been
disabled for this group".
Should I send my request through the developer list?

Cheers

Frank

Am 05.09.2011 20:15, schrieb Jeffrey Spencer:

  You can use dpi=600 as a parameter to increase the resolution but I'm
  not sure if that's what you mean. If you mean the actual compression
  strategy used like to Jpeg2000 per se. Might have to do that after
  saving the file with an image library (for example, PIL).

  Cheers,
  Jeff

  On 09/06/2011 03:21 AM, Frank Breitling wrote:

  Hi,

  I am using matplotlib.savefig to save my figures as JPEG files.
  Now I need to reduce the JPG compression ratio.
  How can I do this?

  Any hint is appreciated.

  Frank

  ------------------------------------------------------------------------------

  Special Offer -- Download ArcSight Logger for FREE!
  Finally, a world-class log management solution at an even better
  price-free! And you'll get a free "Love Thy Logs" t-shirt when you
  download Logger. Secure your free ArcSight Logger TODAY!
  http://p.sf.net/sfu/arcsisghtdev2dev
  _______________________________________________
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  matplotlib-users List Signup and Options

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options