for example, to trim the whitespace border pixels of an "RGBA" image, irrespective of the alpha,
and a minimum requirement of at least three non-near-white pixels in each border row and column,
you would design your padding_condition
as such:
// distance between pixel's rgb and the white color `(255, 255, 255,)`, should be less than `10 * Math.sqrt(3)` for the pixel to be considered near-white
white_padding = (r: number, g: number, b: number, a: number) => (3 * 255**2) - (r**2 + g**2 + b**2) < (3 * 5**2) ? 0.0 : 1.0
trimmed_img_data = trimImagePadding(img_data, white_padding, 3.0)
Generated using TypeDoc
trim the padding of an image based on sum of pixel conditioning of each border's rows and columns