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

Text For Stroke/Outline Doesn't Align properly #2150

Open
frannerkea opened this issue Apr 3, 2024 · 0 comments
Open

Text For Stroke/Outline Doesn't Align properly #2150

frannerkea opened this issue Apr 3, 2024 · 0 comments
Labels
bug Issues that report (apparent) bugs.

Comments

@frannerkea
Copy link

Hey, I'm currently trying to create videos with Moviepy but run into a few problems with the text.

  • First problem: weird artifacts inside the text when applying stroke

Solution: Add another text layer on top without stroke.

  • Second Problem: Text without stroke and with stroke doesn't 100% align correctly.

Here are 2 Images. The first one is how the Moviepy file is exported with weird alignment. The second is a Figma file of how it should look like.
text alignment exsample
MoviePy Export (note: the stroke size is bigger than the Figma file stroke to showcase the issue)

Figam Exsample
Example of what it should look like.

Here is some of the code:

Create text clips with stroke

english_text_stroke = TextClip(english_word, fontsize=font_size, color='white', font=font_path, stroke_color='black', stroke_width=3)

spanish_text_stroke = TextClip(spanish_word, fontsize=font_size, color='white', font=font_path, stroke_color='black', stroke_width=3)

Create text clips without stroke (to overlay on top)

english_text = TextClip(english_word, fontsize=font_size, color='white', font=font_path)

spanish_text = TextClip(spanish_word, fontsize=font_size, color='white', font=font_path)

Position text clips

english_text_stroke = english_text_stroke.set_position((left_column_x - english_text.w // 2, y_position))

spanish_text_stroke = spanish_text_stroke.set_position((right_column_x - spanish_text.w // 2, y_position))

english_text = english_text.set_position((left_column_x - english_text.w // 2, y_position))

spanish_text = spanish_text.set_position((right_column_x - spanish_text.w // 2, y_position))

Does anyone know of any solutions?

@frannerkea frannerkea added the bug Issues that report (apparent) bugs. label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that report (apparent) bugs.
Projects
None yet
Development

No branches or pull requests

1 participant