Optionaloptions: PixelWriterOptionsReadonlyaccumulatorReadonlyconfigReadonlyhistoryReadonlyhistoryReadonlymutatorReadonlypixelOptionalafter: (target: ImageData) => voidOptionalafterUndo: (target: ImageData) => voidOptionalafterRedo: (target: ImageData) => voidNon destructively resizes the ImageData buffer to new dimensions, optionally offsetting the original content. This operation creates a new buffer. It does not scale or stretch pixels; instead, it crops or pads the image based on the new dimensions and provides an offset for repositioning.
The target to resize.
The target width in pixels.
The target height in pixels.
The horizontal offset for placing the original image within the new buffer.
The vertical offset for placing the original image within the new buffer.
A new ImageData instance with the specified dimensions.
Executes transaction and commits the resulting pixel changes as a single
undoable history action.
transaction throws, all accumulated changes are rolled back and the error
is re-thrown. No action is committed.transaction completes without modifying any pixels, no action is committed.withHistory is not re-entrant. Calling it again from inside transaction will
throw immediately to prevent silent data loss from a nested extractPatch.Callback to be executed inside the transaction.
Optionalafter: () => voidCalled after both undo and redo — use for generic change notifications.
OptionalafterUndo: () => voidCalled after undo only — use for dimension or state changes specific to undo.
OptionalafterRedo: () => voidCalled after redo only.
Example