{"id":22375,"library":"skia-python","title":"skia-python","description":"Python bindings for the Skia 2D graphics library. Current version is 144.0.post2, released on 2025-04-28. The project tracks upstream Skia milestones (currently m144) and releases irregularly, often with significant API changes between milestones.","status":"active","version":"144.0.post2","language":"python","source_language":"en","source_url":"https://github.com/kyamagu/skia-python","tags":["skia","2d-graphics","rendering","canvas"],"install":[{"cmd":"pip install skia-python","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Required for pixel buffer operations and array conversion","package":"numpy","optional":false}],"imports":[{"note":"","wrong":"","symbol":"skia","correct":"import skia"}],"quickstart":{"code":"import skia\nimport os\n\n# Create 256x256 red canvas\nsurface = skia.Surface(256, 256)\nwith surface as canvas:\n    paint = skia.Paint(color=skia.ColorRED, style=skia.Paint.kFill_Style)\n    canvas.drawRect(skia.Rect(10, 10, 100, 100), paint)\n\n# Save to PNG\nimage = surface.makeImageSnapshot()\nimage.save('output.png', skia.kPNG)\nprint('Image saved as output.png')","lang":"python","description":"Basic example: create a surface, draw a red rectangle, and save as PNG."},"warnings":[{"fix":"Replace integer values with skia.VkFormat.* and skia.VkImageLayout.*, e.g. skia.VkFormat.kR8G8B8A8_UNORM_VK_FORMAT.","message":"Vulkan APIs now require skia.VkFormat and skia.VkImageLayout enums instead of integer constants. Code using raw Vulkan integer values will break.","severity":"breaking","affected_versions":">=138.0"},{"fix":"Remove the perspective clip argument from affected API calls. Check Skia release notes for exact API changes.","message":"skia.ApplyPerspectiveClip removed upstream. Associated APIs take one fewer argument.","severity":"breaking","affected_versions":">=138.0"},{"fix":"Add the extra argument to incReserve calls. Refer to Skia upstream docs for new signature.","message":"skia.PathBuilder.incReserve now takes one more argument (count plus unknown parameter).","severity":"breaking","affected_versions":">=138.0"},{"fix":"Install mesa-libEGL (e.g., sudo apt install libegl1 on Debian/Ubuntu) or ensure libEGL.so is in library path.","message":"Linux users must have libEGL.so installed (from mesa-libEGL, libglvnd, or Nvidia drivers) or import will fail.","severity":"gotcha","affected_versions":">=87.9rc1, >=138.0rc1"},{"fix":"Use skia.PDF.Metadata() without arguments for defaults, or supply jpegEncoder/jpegDecoder callables.","message":"skia.PDF.MakeDocument() signature changed: jpegEncoder and jpegDecoder fields are now required in Metadata. The zero-argument skia.PDF.Metadata() now includes default JPEG codecs.","severity":"deprecated","affected_versions":">=136.b13"},{"fix":"Install numpy: pip install numpy","message":"Numpy dependency is required; missing numpy leads to import errors in pixel operations.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install libegl1 (Ubuntu/Debian: sudo apt install libegl1, Fedora: sudo dnf install mesa-libEGL)","cause":"Missing libEGL shared library on Linux. Required since v87.9rc1/v138.0rc1.","error":"ImportError: libEGL.so.1: cannot open shared object file: No such file or directory"},{"fix":"Remove references to skia.ApplyPerspectiveClip and adapt code to use fewer arguments in related APIs.","cause":"ApplyPerspectiveClip removed in Skia m138+.","error":"AttributeError: module 'skia' has no attribute 'ApplyPerspectiveClip'"},{"fix":"Check Skia docs for new signature (likely incReserve(self, count, extra)). Pass the required additional argument.","cause":"skia.PathBuilder.incReserve signature changed: now takes an extra argument.","error":"TypeError: incReserve() takes 2 positional arguments but 3 were given"},{"fix":"Install numpy: pip install numpy","cause":"numpy is a required dependency for pixel operations and image I/O.","error":"ModuleNotFoundError: No module named 'numpy'"},{"fix":"Use skia.PDF.Metadata() without arguments and set jpegEncoder/jpegDecoder as attributes if needed.","cause":"Old code passing jpegEncoder to Metadata() constructor; new Metadata() initializes with default codecs.","error":"skia.pdf: Metadata() got an unexpected keyword argument 'jpegEncoder'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}