-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Weird aliasing problem on text border #195
Comments
Hard to say without your code, but the general problem I guess is that ImageMagick is bad at antialiasing. One easy fix is to generate a text with 2x size and 2x the stroke width, then downsize it by half:
Tell me if this works. |
I tried, but I get the same effect and to be clearer, there should not be a stoke on the text. What appears to be a stroke is the artifacts of the merge of 3 layers. I don't think that there's a problem with the aliasing of the text, I think there's a problem when the text and the background is merged. But I'm not sure that I understand how it works mask vs matrix with RGB values. Is the mask the alpha channel? My guess is that when the edge of the letter is merge with the background, it ignores the alpha value of the background. Layer 0 (White image) So when it merges Layer 2 with Layer 1, instead of merging the rgba values of Layer 2 with rgba values of Layer 1, it computes Layer 2 rgba values with rgb values of Layer 1... I don't know if it makes sense or if I'm totally wrong on this one, but it would explain the weird stroke-like effect on the edge of the letters by using solid black instead of the compute value of the merged of layer 0 and layer 1? |
Can you provide some code ? I'll give it a look when I have time. (I wonder if it's not something that I solved in my local version...) |
If we create a ColorClip (overlay) manually and compose the 3 layer, it fixes the problem.
But if we use the on_color function, it creates a CompositeVideoClip of the text and a ColorClip and then get compose with the background.
|
But if I create a CompositeVideo([txt]) before the composition with the overlay and the background, I still get the same problem.
|
Hello. I would like to add about this issue. It seems like there's a problem rendering text when it comes to nested CompositeVideoClip. Let me walk it through.
When i just put a ColorClip and TextClip under one CompositeVideoClip, text renders smoothly. Now, I try moving the TextClip (txt) to a "sub" CompositeClip
text now has weird, sharp, semi-dark border as describe in this issue: It even looks worse if you make the font size smaller. Let me know if I missed out something. Thanks |
I'm having the same issue. I should note that I'm using this instead of |
Still facing this issue. |
I might have the same problem. What I am thinking is that possibly, this is a problem with correctly "cutting" out the letters when applying operations to them? The letters use antialiasing, so "current" them out never really works robustly. At least, the results look pretty much like that. @Zulko @OsaAjani can you look into this? Also, #1395 might propose some fix that could be a starting point for fixing this bug in the project? |
Referencing my example from another issue, here: #2269 (comment) Notice the problematic text borders around the red text: test_output.mp4I am not entirely sure whether this is the same bug or something else, but it looks pretty closely related. |
Ah, that's very possible. I was trying around a bit with the mask, and maybe due to the other bug did the mask in the wrong way while trying to overcome the transparency problem that is now fixed. I am a newbie to moviepy. Will try to look at it in the next days. Any hint where I do things wrong is appreciated, though! |
Basically I put a text, set a background black with an opacity of 0.3 and add it to an image with a white background.
Anyone have an idea why I got those aliasing problems (not sure if it's call like that!?) on the border of the letters?
I don't know enough about video/image processing to understand what's really going on here, but from what I understand, when the text is merged with the background, the alpha is ignored?
The text was updated successfully, but these errors were encountered: