Skip to content

Commit

Permalink
Correctly center image when resizing (#1420)
Browse files Browse the repository at this point in the history
* Correctly center image when resizing (#1418)
  • Loading branch information
jcbrockschmidt authored Jan 13, 2021
1 parent 1987fbd commit df97353
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
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

0 comments on commit df97353

Please sign in to comment.