How to use the ipycanvas.utils.image_bytes_to_array function in ipycanvas

To help you get started, we’ve selected a few ipycanvas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github martinRenou / ipycanvas / ipycanvas / canvas.py View on Github external
"""
        if self.image_data is None:
            raise RuntimeError('No image data, please be sure that ``sync_image_data`` is set to True')

        x = int(x)
        y = int(y)

        if width is None:
            width = self.width - x
        if height is None:
            height = self.height - y

        width = int(width)
        height = int(height)

        image_data = image_bytes_to_array(self.image_data)
        return image_data[y:y + height, x:x + width]