Skip to content

Instantly share code, notes, and snippets.

@uwezi
Created March 11, 2026 14:47
Show Gist options
  • Select an option

  • Save uwezi/5a9427f3c65598fbcb82e5c7e3bc7b0c to your computer and use it in GitHub Desktop.

Select an option

Save uwezi/5a9427f3c65598fbcb82e5c7e3bc7b0c to your computer and use it in GitHub Desktop.
[pixelate] Pixelate Mobjects in Manim. #manim #pil #image #pixel
from PIL.Image import Resampling
class doesthiswork2(Scene):
def construct(self):
vpixels = 40
svg = VGroup(
Circle(),
Text("Test")
)
oheight = svg.height
svg.scale_to_fit_height(8/(config.pixel_height/vpixels),scale_stroke=True)
self.camera.capture_mobject(svg)
image = self.camera.get_image()
iobj = ImageMobject(
image,
resampling_algorithm=Resampling.NEAREST,
).scale(oheight/(8/(config.pixel_height/vpixels)))
self.add(iobj)
self.add(svg.scale_to_fit_height(oheight).shift(3*LEFT))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment