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

White artifacts around the image when rotating an ImageClip with a mask or just a png with transparency in angles that are not 0, 90, 180, 270 ( Added Examples to reproduce it ) #216

Closed
hgonzalezsgn opened this issue Oct 7, 2015 · 4 comments

Comments

@hgonzalezsgn
Copy link

Hi Zulko,

I just download the master and I have white artifacts around the image when rotating an ImageClip with a mask in angles that are not 0, 90, 180, 270 for example I used 60 and have the issue

The following is the code:

from moviepy.editor import *
mask = ImageClip("mask.png", ismask=True)
image = ImageClip("imageToTest.png", False)
imageWithRotation = image.set_mask(mask)
imageWithRotationAndMask = imageWithRotation.rotate(60)
imageWithRotationAndMask.save_frame("result.png")

This are the images used in the script and the result:

imagetotest
mask
result

Thanks!
Hernan

@latexers
Copy link

latexers commented Oct 7, 2015

你好,你的邮件已收到,阅读后尽快回复!


欢迎光临:www.wangmurong.org.cn

@hgonzalezsgn
Copy link
Author

Another important comment is that the issue happens also if instead of a mask I use a png with transparency( edited in photoshop )

from moviepy.editor import *
image = ImageClip("imageWithTransparency.png")
imageWithRotation = imageWithRotation.rotate(60)
imageWithRotation.save_frame("result.png")

imagewithtransparency
result

@hgonzalezsgn hgonzalezsgn changed the title White artifacts around the image when rotating an ImageClip with a mask in angles that are not 0, 90, 180, 270 White artifacts around the image when rotating an ImageClip with a mask or just a png with transparency in angles that are not 0, 90, 180, 270 ( Added Examples to reproduce it ) Oct 7, 2015
@hgonzalezsgn
Copy link
Author

Guys I figured it out! This issue can be closed

It is not a bug just a parameter that need to be change.

You need to change the resample param which defaults to "bicubic" to "nearest" or "bilinear"
rotate(clip, angle, unit='deg', resample="bicubic", expand=True)

For example
imageWithRotation = image.rotate(60 , "deg", "nearest")

Attached the result:

result

@ayoosh007
Copy link

Guys I figured it out! This issue can be closed

It is not a bug just a parameter that need to be change.

You need to change the resample param which defaults to "bicubic" to "nearest" or "bilinear" rotate(clip, angle, unit='deg', resample="bicubic", expand=True)

For example imageWithRotation = image.rotate(60 , "deg", "nearest")

Attached the result:

result

You are a lifesaver.Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants