WebP support

Benjamin Root <ben.root@...1304...> 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

Benjamin Root <ben.root@…1304…> 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

···

On Sat, Oct 2, 2010 at 12:39 PM, Jouni K. Seppänen <jks@…397…> wrote:

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.

···

On Sat, Oct 2, 2010 at 7:39 PM, Jouni K. Seppänen <jks@...397...> 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.

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

···

On 10/02/2010 01:39 PM, Jouni K. Sepp�nen wrote:

Benjamin Root<ben.root@...1304...> 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.
   

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