Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
bc2ec808
Commit
bc2ec808
authored
10 years ago
by
Mark Haines
Browse files
Options
Downloads
Patches
Plain Diff
SYN-32 Use the ANTIALIAS resize method for thumbnailing images
parent
0529a7e2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/media/v1/thumbnailer.py
+3
-3
3 additions, 3 deletions
synapse/media/v1/thumbnailer.py
with
3 additions
and
3 deletions
synapse/media/v1/thumbnailer.py
+
3
−
3
View file @
bc2ec808
...
@@ -48,7 +48,7 @@ class Thumbnailer(object):
...
@@ -48,7 +48,7 @@ class Thumbnailer(object):
def
scale
(
self
,
output_path
,
width
,
height
,
output_type
):
def
scale
(
self
,
output_path
,
width
,
height
,
output_type
):
"""
Rescales the image to the given dimensions
"""
"""
Rescales the image to the given dimensions
"""
scaled
=
self
.
image
.
resize
((
width
,
height
),
Image
.
BILINEAR
)
scaled
=
self
.
image
.
resize
((
width
,
height
),
Image
.
ANTIALIAS
)
return
self
.
save_image
(
scaled
,
output_type
,
output_path
)
return
self
.
save_image
(
scaled
,
output_type
,
output_path
)
def
crop
(
self
,
output_path
,
width
,
height
,
output_type
):
def
crop
(
self
,
output_path
,
width
,
height
,
output_type
):
...
@@ -65,7 +65,7 @@ class Thumbnailer(object):
...
@@ -65,7 +65,7 @@ class Thumbnailer(object):
if
width
*
self
.
height
>
height
*
self
.
width
:
if
width
*
self
.
height
>
height
*
self
.
width
:
scaled_height
=
(
width
*
self
.
height
)
//
self
.
width
scaled_height
=
(
width
*
self
.
height
)
//
self
.
width
scaled_image
=
self
.
image
.
resize
(
scaled_image
=
self
.
image
.
resize
(
(
width
,
scaled_height
),
Image
.
BILINEAR
(
width
,
scaled_height
),
Image
.
ANTIALIAS
)
)
crop_top
=
(
scaled_height
-
height
)
//
2
crop_top
=
(
scaled_height
-
height
)
//
2
crop_bottom
=
height
+
crop_top
crop_bottom
=
height
+
crop_top
...
@@ -73,7 +73,7 @@ class Thumbnailer(object):
...
@@ -73,7 +73,7 @@ class Thumbnailer(object):
else
:
else
:
scaled_width
=
(
height
*
self
.
width
)
//
self
.
height
scaled_width
=
(
height
*
self
.
width
)
//
self
.
height
scaled_image
=
self
.
image
.
resize
(
scaled_image
=
self
.
image
.
resize
(
(
scaled_width
,
height
),
Image
.
BILINEAR
(
scaled_width
,
height
),
Image
.
ANTIALIAS
)
)
crop_left
=
(
scaled_width
-
width
)
//
2
crop_left
=
(
scaled_width
-
width
)
//
2
crop_right
=
width
+
crop_left
crop_right
=
width
+
crop_left
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment