Skip to content

bitmaptools.rotozoom() Hard Fault #10883

@FoamyGuy

Description

@FoamyGuy

CircuitPython version and board name

Adafruit CircuitPython 10.2.0-alpha.1 on 2026-02-18; Adafruit QT Py ESP32S2 with ESP32S2

Code/REPL

import displayio
import bitmaptools

displayio.release_displays()

# Load the seconds hand BMP
sec_bmp = displayio.OnDiskBitmap("red_second_hand.bmp")

# Full-size canvas — affordable with PSRAM
canvas = displayio.Bitmap(240, 240, 2)

canvas_palette = displayio.Palette(2)
canvas_palette[0] = 0xFF00FF  # magenta = transparent
canvas_palette[1] = 0xFF2200  # red-orange
canvas_palette.make_transparent(0)

canvas_tilegrid = displayio.TileGrid(canvas, pixel_shader=canvas_palette)

clock_with_seconds = displayio.Group()
clock_with_seconds.append(canvas_tilegrid)

bitmaptools.rotozoom(
        canvas,
        sec_bmp,
        ox=120,   # clock centre x
        oy=120,   # clock centre y
        px=6,     # pivot x: centre of 12px wide BMP
        py=79,    # pivot y: bottom of 80px tall BMP
        angle=0,
    )

Behavior

causes hard fault reset:

Auto-reload is off.
Running in safe mode! Not running saved code.

You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Hard fault: memory access or instruction error.
Please file an issue with your program at github.com/adafruit/circuitpython/issues.
Press reset to exit safe mode.

Additional information

The root cause might be using OnDiskBitmap as a source for the rotozoom, I'm not sure that is allowed really.

I'll do some more testing on different device to try to confirm the cause and can work on a change to raise a more informative exception when the wrong type object is passed to rotozoom if it is from that.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions