Skip to content

Commit

Permalink
deploy: 23834f6
Browse files Browse the repository at this point in the history
  • Loading branch information
OsaAjani committed Jan 10, 2025
1 parent cc09c70 commit 726e115
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
23 changes: 20 additions & 3 deletions _modules/moviepy/video/VideoClip.html
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,11 @@ <h1>Source code for moviepy.video.VideoClip</h1><div class="highlight"><pre>

<span class="sd"> duration</span>
<span class="sd"> Duration of the clip</span>

<span class="sd"> bg_radius</span>
<span class="sd"> A paramater to round the edges of the text background. Defaults to 0 if there</span>
<span class="sd"> is no background. It will have no effect if there is no bg_colour added.</span>
<span class="sd"> The higher the value, the more rounded the corners will become.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="nd">@convert_path_to_string</span><span class="p">(</span><span class="s2">&quot;filename&quot;</span><span class="p">)</span>
Expand All @@ -1920,6 +1925,7 @@ <h1>Source code for moviepy.video.VideoClip</h1><div class="highlight"><pre>
<span class="n">interline</span><span class="o">=</span><span class="mi">4</span><span class="p">,</span>
<span class="n">transparent</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">duration</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">bg_radius</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="c1"># TODO : Move this with other bg_param on next breaking release</span>
<span class="p">):</span>
<span class="k">def</span><span class="w"> </span><span class="nf">break_text</span><span class="p">(</span>
<span class="n">width</span><span class="p">,</span> <span class="n">text</span><span class="p">,</span> <span class="n">font</span><span class="p">,</span> <span class="n">font_size</span><span class="p">,</span> <span class="n">stroke_width</span><span class="p">,</span> <span class="n">align</span><span class="p">,</span> <span class="n">spacing</span>
Expand Down Expand Up @@ -2179,9 +2185,20 @@ <h1>Source code for moviepy.video.VideoClip</h1><div class="highlight"><pre>
<span class="k">if</span> <span class="n">bg_color</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">transparent</span><span class="p">:</span>
<span class="n">bg_color</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>

<span class="n">img</span> <span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">img_mode</span><span class="p">,</span> <span class="p">(</span><span class="n">img_width</span><span class="p">,</span> <span class="n">img_height</span><span class="p">),</span> <span class="n">color</span><span class="o">=</span><span class="n">bg_color</span><span class="p">)</span>
<span class="n">pil_font</span> <span class="o">=</span> <span class="n">ImageFont</span><span class="o">.</span><span class="n">truetype</span><span class="p">(</span><span class="n">font</span><span class="p">,</span> <span class="n">font_size</span><span class="p">)</span>
<span class="n">draw</span> <span class="o">=</span> <span class="n">ImageDraw</span><span class="o">.</span><span class="n">Draw</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
<span class="k">if</span> <span class="n">bg_radius</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">bg_radius</span> <span class="o">=</span> <span class="mi">0</span>

<span class="k">if</span> <span class="n">bg_radius</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">img</span> <span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">img_mode</span><span class="p">,</span> <span class="p">(</span><span class="n">img_width</span><span class="p">,</span> <span class="n">img_height</span><span class="p">),</span> <span class="n">color</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span>
<span class="n">pil_font</span> <span class="o">=</span> <span class="n">ImageFont</span><span class="o">.</span><span class="n">truetype</span><span class="p">(</span><span class="n">font</span><span class="p">,</span> <span class="n">font_size</span><span class="p">)</span>
<span class="n">draw</span> <span class="o">=</span> <span class="n">ImageDraw</span><span class="o">.</span><span class="n">Draw</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
<span class="n">draw</span><span class="o">.</span><span class="n">rounded_rectangle</span><span class="p">(</span>
<span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">img_width</span><span class="p">,</span> <span class="n">img_height</span><span class="p">],</span> <span class="n">radius</span><span class="o">=</span><span class="n">bg_radius</span><span class="p">,</span> <span class="n">fill</span><span class="o">=</span><span class="n">bg_color</span>
<span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">img</span> <span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">img_mode</span><span class="p">,</span> <span class="p">(</span><span class="n">img_width</span><span class="p">,</span> <span class="n">img_height</span><span class="p">),</span> <span class="n">color</span><span class="o">=</span><span class="n">bg_color</span><span class="p">)</span>
<span class="n">pil_font</span> <span class="o">=</span> <span class="n">ImageFont</span><span class="o">.</span><span class="n">truetype</span><span class="p">(</span><span class="n">font</span><span class="p">,</span> <span class="n">font_size</span><span class="p">)</span>
<span class="n">draw</span> <span class="o">=</span> <span class="n">ImageDraw</span><span class="o">.</span><span class="n">Draw</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>

<span class="c1"># Dont need allow break here, because we already breaked in caption</span>
<span class="n">text_width</span><span class="p">,</span> <span class="n">text_height</span> <span class="o">=</span> <span class="n">find_text_size</span><span class="p">(</span>
Expand Down
5 changes: 4 additions & 1 deletion reference/reference/moviepy.video.VideoClip.TextClip.html
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@
<h1>moviepy.video.VideoClip.TextClip<a class="headerlink" href="#moviepy-video-videoclip-textclip" title="Permalink to this heading">#</a></h1>
<dl class="py class">
<dt class="sig sig-object py" id="moviepy.video.VideoClip.TextClip">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">moviepy.video.VideoClip.</span></span><span class="sig-name descname"><span class="pre">TextClip</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">font</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">text</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">font_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">(None,</span> <span class="pre">None)</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">margin</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">(None,</span> <span class="pre">None)</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">color</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'black'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bg_color</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stroke_color</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stroke_width</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">method</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'label'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">text_align</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'left'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">horizontal_align</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'center'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">vertical_align</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'center'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">interline</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transparent</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">duration</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/moviepy/video/VideoClip.html#TextClip"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#moviepy.video.VideoClip.TextClip" title="Permalink to this definition">#</a></dt>
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">moviepy.video.VideoClip.</span></span><span class="sig-name descname"><span class="pre">TextClip</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">font</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">text</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">font_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">(None,</span> <span class="pre">None)</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">margin</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">(None,</span> <span class="pre">None)</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">color</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'black'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bg_color</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stroke_color</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stroke_width</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">method</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'label'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">text_align</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'left'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">horizontal_align</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'center'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">vertical_align</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'center'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">interline</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transparent</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">duration</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bg_radius</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/moviepy/video/VideoClip.html#TextClip"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#moviepy.video.VideoClip.TextClip" title="Permalink to this definition">#</a></dt>
<dd><p>Class for autogenerated text clips.</p>
<p>Creates an ImageClip originating from a script-generated text image.</p>
<dl class="field-list simple">
Expand Down Expand Up @@ -592,6 +592,9 @@ <h1>moviepy.video.VideoClip.TextClip<a class="headerlink" href="#moviepy-video-v
<li><p><strong>transparent</strong><code class="docutils literal notranslate"><span class="pre">True</span></code> (default) if you want to take into account the
transparency in the image.</p></li>
<li><p><strong>duration</strong> – Duration of the clip</p></li>
<li><p><strong>bg_radius</strong> – A paramater to round the edges of the text background. Defaults to 0 if there
is no background. It will have no effect if there is no bg_colour added.
The higher the value, the more rounded the corners will become.</p></li>
</ul>
</dd>
</dl>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 726e115

Please sign in to comment.