Skip to content

Rendering transparent png graphics edges will blend the background color #4451

@githowe

Description

@githowe

Description of bug / unexpected behavior

I drew a circle in the scene, added the -t parameter when rendering, and then added a background to the picture. I found that the edge of the graphic was mixed with the background color.

Expected behavior

Graphic edges should not blend with the background color

How to reproduce the issue

Code for reproducing the problem
from manim import *

config.pixel_width = 400
config.pixel_height = 400
config.frame_height = 400.0
config.frame_width = 400.0

# 传入一个像素宽度,返回Manim单位的线条粗细
def calculate_stroke_width(pixelWidth):
    # 先计算Manim单位的像素宽度
    unitPixel = config.pixel_width / config.frame_width
    # 然后计算线条的Manim单位粗细,线条粗细单位是Manim单位的0.01
    strokeWidth = pixelWidth / unitPixel * 100
    return strokeWidth

# 创建一个主场景继承至场景类
class MainScene(Scene):
    # 定义构造方法
    def construct(self):
        # 绘制圆形
        circle = Circle(radius=100, stroke_width=calculate_stroke_width(4), color=WHITE)
        self.add(circle)

Additional media files

Images/GIFs Image

System specifications

System Details
  • OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)):
  • RAM:
  • Python version (python/py/python3 --version):
  • Installed modules (provide output from pip list):
OS: Windows10 Home 22H2
RAM: 48GB
Python version: 3.12.0

Additional comments

I noticed that some users have reported this issue before, and you have fixed it. #2273

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions