FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bbox_inches='tight' raises KeyError for JPG and TIF · Issue #109 · matplotlib/matplotlib · GitHub

Repository navigation

bbox_inches='tight' raises KeyError for JPG and TIF #109

Closed

Description

The following script:

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(2,2,1)
ax.scatter([0.5], [0.5])
fig.savefig('test.jpg', bbox_inches='tight')

raises the following exception:

Traceback (most recent call last):
  File "tif.py", line 8, in <module>
    fig.savefig('test.jpg', bbox_inches='tight')
  File "/Users/tom/Library/Python/2.6/site-packages/matplotlib/figure.py", line 1162, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/Users/tom/Library/Python/2.6/site-packages/matplotlib/backend_bases.py", line 1943, in print_figure
    **kwargs)
  File "/Users/tom/Library/Python/2.6/site-packages/matplotlib/backend_bases.py", line 1803, in print_jpg
    return image.save(filename_or_obj, **options)
  File "/Users/tom/Library/Python/2.6/site-packages/PIL/Image.py", line 1423, in save
    raise KeyError(ext) # unknown extension
KeyError: ''

and same for TIFF files. If bbox_inches='tight' isn't supported, maybe a warning would be better?

I'm using 5df5830

Activity

  1. leejjoon commented on May 11, 2011

    Contributor

    The patch is applied to the v1.0.x branch and merged to the master.

  2. added a commit that references this issue on Jun 2, 2011
    8c2647f
  3. kilojoules commented on Jul 29, 2015

    I got this error for .jpeg

  4. tacaswell commented on Jul 30, 2015

    Member

    @kilojoules What version of mpl are you using? If it is 1.4.x please create a new issue with a minimal case to reproduce, if it is older, please upgrade and check if you can reproduce on a current version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL