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

MOV/transparency decolorization bug #3233

Open
xonoma opened this issue May 6, 2023 · 0 comments
Open

MOV/transparency decolorization bug #3233

xonoma opened this issue May 6, 2023 · 0 comments

Comments

@xonoma
Copy link

xonoma commented May 6, 2023

Description of bug / unexpected behavior

  1. I run Manim Community v0.17.3 on 3 separate machines: a Macbook Air, a Mac Studio, and Linux/Pop OS 22.04.

  2. Manim by default works well all 3 machines for generating MP4 files.

  3. However when I generate MOV files with transparency, a bug appears that decolours all non-transparent regions.

Expected behavior

  1. Consider this sample code. It generates a non-transparent MP4 file, of a rectangle stroked in RED. This code behaves similarly on all 3 of my machines:

        self.play(FadeIn(Rectangle(stroke_color=RED, stroke_width=10)))
        self.wait(2)
    red-stroked-rectangle.mp4
  2. I then add transparency to the config dict: "transparent": True.

  3. On my Macbook Air, the above code renders correctly. It generates the same contents in a MOV file, and with transparency. This is expected rendering behaviour.

  4. But on my Mac Studio/Linux, the code behaves wrongly. It generates a MOV file with transparency, but where the red stroke (or any region that is non-transparent) is decoloured to cyan. Such is unexpected output:

    red-stroked-rectangle.mov

    wrong-output-cyan

Additional comments

  1. What puzzles me: my Macbook Air and the Mac Studio are virtually similar in every respect. If only the Linux had a different output, I could perhaps chalk it to a local machine's dependencies issue. But if I can generate transparency with MOV files on my Mac Air, then I should be able to do so too with the Mac Studio.

  2. The cyan colour makes me suspect a compositing issue.

  3. I am also inclined to believe it's a Cairo or a Pango issue, traced into Manim's settings, since there's a Stack Overflow comment which mentions the decolorization phenomenon.

    But if I reduce the code, and generate a transparent image:

        self.add(Rectangle(stroke_color=RED, stroke_width=10))

    red-stroked-rectangle

    ... then I get a PNG file that is transparent, and is correctly stroked RED (not decoloured).

    Which means that my Linux/Mac Studio's Cairo installation is able to generate transparency correctly for PNG images. (Yet Manim somehow cannot build transparent MOV files with it.) So I am no longer sure that this is strictly a Cairo issue.

System specifications

  1. Machines are as above.

  2. Python 3.10

  3. Modules (in a virtual environment): Manim v.0.17.3 only

  4. I installed the main dependencies, Cairo/Pango, on my Linux with the official apt commands:

     sudo apt install build-essential python3-dev libcairo2-dev libpango1.0-dev ffmpeg
    
  5. I installed the dependencies on my Macbook Air/Mac Studio with these official commands:

     brew install py3cairo ffmpeg
     brew install pango scipy
     pip3 install manim
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant