Authored by RFID.me Last updated Editorial policy

Plain English

Erases (clears to white) the specified rectangular area in the image buffer. Anything previously drawn in that area is removed. Per TSPL2 PG §ERASE (p43); the PG's canonical example draws BAR 100,100,300,300 then ERASE 150,150,200,200 to carve a hole out of the centre — document order matters, since ERASE paints over earlier draw commands.

When to use

When you need to clear a specific region of the label without clearing the entire buffer — carving holes, masking, or selective inverse of BAR. CLS clears the whole buffer; use ERASE for surgical strikes.

Syntax

ERASE x,y,width,height

Parameters

ParameterDescription
x
Left edge X coordinate of the region in dots (TSPL2 PG: X_start)
y
Top edge Y coordinate of the region in dots (TSPL2 PG: Y_start)
width
Region width in the x-axis direction in dots (TSPL2 PG: X_width)
height
Region height in the y-axis direction in dots (TSPL2 PG: Y_height)

Example

BAR 100,100,300,300
ERASE 150,150,200,200

Draw a 300x300 black bar at (100,100) then carve a 200x200 white hole out of its centre (TSPL2 PG §ERASE example)

Try it in the playground View all TSPL commands