GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bbox_inches='tight' raises KeyError for JPG and TIF · Issue #109 · matplotlib/matplotlib

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

New issue
Copy link
New issue
Copy link
Closed
Closed
bbox_inches='tight' raises KeyError for JPG and TIF#109
Copy link

Description

@astrofrog
astrofrog
opened on May 10, 2011
Issue body actions

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
    closed this as completedin 53f8139on May 11, 2011
  2. leejjoon commented on May 11, 2011

    @leejjoon
    leejjoon
    on May 11, 2011
    Contributor
    More actions

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

  3. ddale
    added a commit that references this issue on Jun 2, 2011

    tight_bbox is supported for jpg and tiff outputs. closes matplotlib#109.

    This issue will close once commit 8c2647f is merged into the 'master' branch.
    8c2647f
  4. kilojoules commented on Jul 29, 2015

    @kilojoules
    kilojoules
    on Jul 29, 2015
    More actions

    I got this error for .jpeg

  5. tacaswell commented on Jul 30, 2015

    @tacaswell
    tacaswell
    on Jul 30, 2015
    Member
    More actions

    @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

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.