Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly center image when resizing #1420

Merged
merged 3 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Lots of method and parameter names have been changed. This will be explained bet
### Fixed <!-- for any bug fixes -->
- Fixed BitmapClip with fps != 1 not returning the correct frames or crashing [#1333]
- Fixed `rotate` sometimes failing with `ValueError: axes don't match array` [#1335]
- Changed deprecated `tostring` method by `tobytes` in `video.io.gif_writers::write_gif` #1429
- Fixed positioning error generating frames in `CompositeVideoClip` [\#1420](https://github.com/Zulko/moviepy/pull/1420)
- Changed deprecated `tostring` method by `tobytes` in `video.io.gif_writers::write_gif` [\#1429](https://github.com/Zulko/moviepy/pull/1429)

## [v2.0.0.dev2](https://github.com/zulko/moviepy/tree/v2.0.0.dev2) (2020-10-05)

Expand Down
4 changes: 2 additions & 2 deletions moviepy/video/VideoClip.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ def blit_on(self, picture, t):
on the given `picture`, the position of the clip being given
by the clip's ``pos`` attribute. Meant for compositing.
"""
hf, wf = picture.size
wf, hf = picture.size

ct = t - self.start # clip time

Expand Down Expand Up @@ -631,7 +631,7 @@ def blit_on(self, picture, t):
else:
im_mask = None

hi, wi = im_img.size
wi, hi = im_img.size
# SET POSITION
pos = self.pos(ct)

Expand Down
12 changes: 5 additions & 7 deletions moviepy/video/tools/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ def blit(im1, im2, pos=None, mask=None):
``mask`` if provided.
"""
if pos is None:
pos = [0, 0]

xp, yp = pos
xp1 = max(0, xp)
yp1 = max(0, yp)

im2.paste(im1, (xp1, yp1), mask)
pos = (0, 0)
else:
# Cast to tuple in case pos is not subscriptable.
pos = tuple(pos)
im2.paste(im1, pos, mask)
return im2


Expand Down