Saving image in .jpeg format

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Saving image in .jpeg format

Emanuele Passera
Hi all,
I have always used .png format for my matplotlib applications but now i am
compelled to save many figures in .jpeg format.
Those image should be automatically saved (no GUI) but i can't find out how to
save the images.

Executing this scripts

import pylab as p
p.rcParams['backend']='gdk'
p.figure(1)
p.plot([1,2,3,4,5,6],[3,7,5,4,6,3])
p.savefig("example.jpg")

It gives me this error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 345, in
savefig
    return fig.savefig(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 990, in
savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line
1373, in print_figure
    '%s.' % (format, ', '.join(formats)))
ValueError: Format "jpg" is not supported.
Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz.

Can anyone help me ? (.jpeg extension it doesn't work too)
By the way, what is the best backend to fulfill the task ? (better quality and
less memory leackage ?)

Thank you

--
------------------------------------------------------------
Emanuele Passera

Tele-Rilevamento Europa - T.R.E. s.r.l.
a POLIMI spin-off company
Via Vittoria Colonna, 7
20149 Milano - Italia
tel.: +39.02.4343.121
fax: +39.02.4343.1230
e-mail: [hidden email]
web: www.treuropa.com
-------------------------------------------------------------


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-announce mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-announce