8000 Let dpi be set when saving JPEG using Agg backend · matplotlib/matplotlib@8fd849d · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8fd849d

Browse files
committed
Let dpi be set when saving JPEG using Agg backend
1 parent 225a4a0 commit 8fd849d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/backends/backend_agg.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,10 +568,12 @@ def print_jpg(self, filename_or_obj, *args, **kwargs):
568568
background = Image.new('RGB', size, color)
569569
background.paste(image, image)
570570
options = restrict_dict(kwargs, ['quality', 'optimize',
571-
'progressive'])
571+
'progressive', 'dpi'])
572572

573573
if 'quality' not in options:
574574
options['quality'] = rcParams['savefig.jpeg_quality']
575+
# Set the same dpi in both x and y directions
576+
options['dpi'] = (options['dpi'], options['dpi'])
575577

576578
return background.save(filename_or_obj, format='jpeg', **options)
577579
print_jpeg = print_jpg

0 commit comments

Comments
 (0)
0