Re: [Matplotlib-users] WebP support

2010-10-04 Thread Michael Droettboom
On 10/02/2010 01:39 PM, Jouni K. Seppänen wrote:
 Benjamin Rootben.r...@ou.edu  writes:


 And yet, we still allow for saving to jpegs.
  
 Wow, I didn't know. Last time I tried that I got a traceback, and
 assumed that it was not supported exactly because jpeg is a nonsensical
 format for most graphs.

 I just tried again, and got TypeError: 'int' object is unsubscriptable
 from PIL/JpegImagePlugin.pyc in _save(im, fp, filename). I suppose this
 doesn't get much testing.

Aside from the question of whether we should support JPEGs, etc., that 
code path should work (and in fact it does on my machine).  What version 
of PIL do you have installed, and can you provide the full traceback 
here?  I'd like to get to the bottom of this bug, even if it's an 
infrequently used feature.

Mike

-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


--
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] WebP support

2010-10-04 Thread Jouni K . Seppänen
Michael Droettboom md...@stsci.edu writes:

 On 10/02/2010 01:39 PM, Jouni K. Seppänen wrote:
 Benjamin Rootben.r...@ou.edu  writes:


 And yet, we still allow for saving to jpegs.
  
 Wow, I didn't know. Last time I tried that I got a traceback, and
 assumed that it was not supported exactly because jpeg is a nonsensical
 format for most graphs.

 I just tried again, and got TypeError: 'int' object is unsubscriptable
 from PIL/JpegImagePlugin.pyc in _save(im, fp, filename). I suppose this
 doesn't get much testing.

 Aside from the question of whether we should support JPEGs, etc., that 
 code path should work (and in fact it does on my machine).  What version 
 of PIL do you have installed, and can you provide the full traceback 
 here?  

It seems that I have an egg install of version 1.1.6., and here's a
traceback:

Traceback (most recent call last):
  File stdin, line 1, in module
  File /Users/jks/Hacking/mpl/git/lib/matplotlib/pyplot.py, line 363, in 
savefig
return fig.savefig(*args, **kwargs)
  File /Users/jks/Hacking/mpl/git/lib/matplotlib/figure.py, line 1160, in 
savefig
self.canvas.print_figure(*args, **kwargs)
  File /Users/jks/Hacking/mpl/git/lib/matplotlib/backend_bases.py, line 1961, 
in print_figure
**kwargs)
  File /Users/jks/Hacking/mpl/git/lib/matplotlib/backend_bases.py, line 1787, 
in print_jpg
return image.save(filename_or_obj, **kwargs)
  File /Library/Python/2.6/site-packages/PIL/Image.py, line 1405, in save
save_handler(self, fp, filename)
  File /Library/Python/2.6/site-packages/PIL/JpegImagePlugin.py, line 406, in 
_save
dpi[0], dpi[1]
TypeError: 'int' object is unsubscriptable

It looks like something is now passing a dpi keyword argument to
print_jpg, but something inside PIL is expecting its value to be a
sequence. I'll commit a fix.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] WebP support

2010-10-02 Thread Nils Wagner
Hi all,

just curious - is the WebP format supported by matplotlib 
?

Nils


http://code.google.com/intl/de-DE/speed/webp/

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] WebP support

2010-10-02 Thread Jouni K . Seppänen
Nils Wagner nwag...@iam.uni-stuttgart.de writes:

 just curious - is the WebP format supported by matplotlib 

No. It seems to be a method for lossy compression of photographs and
therefore not likely to be useful for line drawings - or what did you
have in mind?

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] WebP support

2010-10-02 Thread Benjamin Root
On Sat, Oct 2, 2010 at 7:28 AM, Jouni K. Seppänen j...@iki.fi wrote:

 Nils Wagner nwag...@iam.uni-stuttgart.de writes:

  just curious - is the WebP format supported by matplotlib

 No. It seems to be a method for lossy compression of photographs and
 therefore not likely to be useful for line drawings - or what did you
 have in mind?

 --
 Jouni K. Seppänen
 http://www.iki.fi/jks



And yet, we still allow for saving to jpegs.  Also, matplotlib is also able
to do imshow(), pcolor() and other rasterized drawings, so we aren't
restricted to just line drawings.

Nils, the answer is no, we don't support webp -- yet.  There is no reason
why we can't eventually do so, and patches will always be welcomed.  I just
wouldn't expect it anytime soon.

Ben Root
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] WebP support

2010-10-02 Thread Benjamin Root
On Sat, Oct 2, 2010 at 11:54 AM, Darren Dale dsdal...@gmail.com wrote:

 On Sat, Oct 2, 2010 at 11:58 AM, Benjamin Root ben.r...@ou.edu wrote:
  On Sat, Oct 2, 2010 at 7:28 AM, Jouni K. Seppänen j...@iki.fi wrote:
 
  Nils Wagner nwag...@iam.uni-stuttgart.de writes:
 
   just curious - is the WebP format supported by matplotlib
 
  No. It seems to be a method for lossy compression of photographs and
  therefore not likely to be useful for line drawings - or what did you
  have in mind?
 
  And yet, we still allow for saving to jpegs.

 Only some of the non-agg backends support saving to jpegs. Whenever
 someone posts to the list asking why jpegs are not supported, the
 answer is that, aside from not being supported by agg, lossy formats
 like jpeg are a poor choice for saving line art.


Heh, I never noticed that.  On this computer, I use TkAgg, and it worked
just fine.  Admittedly, I haven't tried this out much because I usually use
png or one of the vector-based formats.

Ben Root
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] WebP support

2010-10-02 Thread Jouni K . Seppänen
Benjamin Root ben.r...@ou.edu writes:

 And yet, we still allow for saving to jpegs.

Wow, I didn't know. Last time I tried that I got a traceback, and
assumed that it was not supported exactly because jpeg is a nonsensical
format for most graphs.

I just tried again, and got TypeError: 'int' object is unsubscriptable
from PIL/JpegImagePlugin.pyc in _save(im, fp, filename). I suppose this
doesn't get much testing.

 Also, matplotlib is also able to do imshow(), pcolor() and other
 rasterized drawings, so we aren't restricted to just line drawings.

Yes, I guess there are some circumstances in which this would make
sense. Would supporting WebP require new library dependencies?

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] WebP support

2010-10-02 Thread Benjamin Root
On Sat, Oct 2, 2010 at 12:39 PM, Jouni K. Seppänen j...@iki.fi wrote:

 Benjamin Root ben.r...@ou.edu writes:

  And yet, we still allow for saving to jpegs.

 Wow, I didn't know. Last time I tried that I got a traceback, and
 assumed that it was not supported exactly because jpeg is a nonsensical
 format for most graphs.

 I just tried again, and got TypeError: 'int' object is unsubscriptable
 from PIL/JpegImagePlugin.pyc in _save(im, fp, filename). I suppose this
 doesn't get much testing.


Yeah, I just double-checked which backend I was using and it turned out to
be GTKAgg (I forgot that I changed it at one point for a test).  In TkAgg, I
get the same error message you report.


  Also, matplotlib is also able to do imshow(), pcolor() and other
  rasterized drawings, so we aren't restricted to just line drawings.

 Yes, I guess there are some circumstances in which this would make
 sense. Would supporting WebP require new library dependencies?

 --
 Jouni K. Seppänen
 http://www.iki.fi/jks


I am certainly not an expert, but it would appear that we offload a lot of
the file-format stuff to PIL anyway.  So, if PIL ever supports WebP, then I
would imagine (although I could be wrong) that it would be fairly trivial to
add support to WebP at least to whereever we support JPEG.

Ben Root
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] WebP support

2010-10-02 Thread Gaius Hammond
It's really not clear to me why we would want to lower the quality of our 
graphs to save Google's bandwidth bills. Because that's all this is...



Cheers,



G




--

-Original Message-
From: Nils Wagner nwag...@iam.uni-stuttgart.de
Date: Sat, 02 Oct 2010 12:59:12 
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] WebP support

Hi all,

just curious - is the WebP format supported by matplotlib 
?

Nils


http://code.google.com/intl/de-DE/speed/webp/

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] WebP support

2010-10-02 Thread Daπid
On Sat, Oct 2, 2010 at 7:39 PM, Jouni K. Seppänen j...@iki.fi wrote:
 And yet, we still allow for saving to jpegs.

 Wow, I didn't know. Last time I tried that I got a traceback, and
 assumed that it was not supported exactly because jpeg is a nonsensical
 format for most graphs.

Don't forget MPL is also capable of dealing with photographs, and it
is really useful. I am currently working in two scientific projects
based on this capability, and for some issues could be useful to save
JPGs.

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users