PNG encoder honoring the optimize_png opt-in (upstream #139 / #199).
When optimize is true, the image package's max-compression level (9)
is used; otherwise its default (level 6) preserves the existing fast
generate behavior. Lossless either way.
True if the decoded image has at least one non-opaque pixel.
Short-circuits on the first match. Used by doctor / strict mode for
the iOS App Store alpha-rejection rule (upstream #172).
True if image is not square (width != height). Used by doctor /
strict mode to warn about non-square sources, which the resize step
silently squishes today (upstream #214).
Pads a non-square image onto a square canvas of side max(w, h) filled
with backgroundColor and centers the source on it. Returns image
unchanged when it is already square (idempotent — safe to call multiple
times, e.g. by both a platform writer that pre-pads and a downstream
createResizedImage call that also has a background color).