Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions roborock/map/b01_q10_map_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,10 +837,10 @@ def parsed_from_packet(self, packet: Q10MapPacket) -> ParsedMapData:
def _render(self, packet: Q10MapPacket) -> Image.Image:
"""Render the Q10 grid with the V1 map palette."""
palette = _build_palette(packet.grid, packet.width)
rgba = bytearray()
for value in packet.grid:
rgba.extend(palette[value])
img = Image.frombytes("RGBA", (packet.width, packet.height), bytes(rgba))
flat_palette = [channel for color in palette for channel in color]
p_img = Image.frombytes("P", (packet.width, packet.height), packet.grid)
p_img.putpalette(flat_palette, rawmode="RGBA")
img = p_img.convert("RGBA")
# The ss07 grid is stored top-down (row 0 = top of the home), so it is
# rendered as-is -- unlike the V1/Q7 convention, no vertical flip.
scale = self._config.map_scale
Expand Down
Loading