compress For Upload
Ensures image is at most maxBytes by re-encoding it as JPEG, stepping the quality down and then repeatedly downscaling and re-compressing until it fits (not a single pass — it keeps shrinking and re-encoding each cycle until the output is within maxBytes). Returns image unchanged when it is already within the limit, or when it cannot be decoded. Backed per-platform because only the native image codecs can resize and re-encode bitmaps; the crop step still emits large PNGs, so this is the common chokepoint that keeps avatar and banner uploads small.
Ensures image is at most maxBytes by re-encoding it as JPEG, stepping the quality down and then repeatedly downscaling and re-compressing until it fits (not a single pass — it keeps shrinking and re-encoding each cycle until the output is within maxBytes). Returns image unchanged when it is already within the limit, or when it cannot be decoded. Backed per-platform because only the native image codecs can resize and re-encode bitmaps; the crop step still emits large PNGs, so this is the common chokepoint that keeps avatar and banner uploads small.
Ensures image is at most maxBytes by re-encoding it as JPEG, stepping the quality down and then repeatedly downscaling and re-compressing until it fits (not a single pass — it keeps shrinking and re-encoding each cycle until the output is within maxBytes). Returns image unchanged when it is already within the limit, or when it cannot be decoded. Backed per-platform because only the native image codecs can resize and re-encode bitmaps; the crop step still emits large PNGs, so this is the common chokepoint that keeps avatar and banner uploads small.
Ensures image is at most maxBytes by re-encoding it as JPEG, stepping the quality down and then repeatedly downscaling and re-compressing until it fits (not a single pass — it keeps shrinking and re-encoding each cycle until the output is within maxBytes). Returns image unchanged when it is already within the limit, or when it cannot be decoded. Backed per-platform because only the native image codecs can resize and re-encode bitmaps; the crop step still emits large PNGs, so this is the common chokepoint that keeps avatar and banner uploads small.
Ensures image is at most maxBytes by re-encoding it as JPEG, stepping the quality down and then repeatedly downscaling and re-compressing until it fits (not a single pass — it keeps shrinking and re-encoding each cycle until the output is within maxBytes). Returns image unchanged when it is already within the limit, or when it cannot be decoded. Backed per-platform because only the native image codecs can resize and re-encode bitmaps; the crop step still emits large PNGs, so this is the common chokepoint that keeps avatar and banner uploads small.
Ensures image is at most maxBytes by re-encoding it as JPEG, stepping the quality down and then repeatedly downscaling and re-compressing until it fits (not a single pass — it keeps shrinking and re-encoding each cycle until the output is within maxBytes). Returns image unchanged when it is already within the limit, or when it cannot be decoded. Backed per-platform because only the native image codecs can resize and re-encode bitmaps; the crop step still emits large PNGs, so this is the common chokepoint that keeps avatar and banner uploads small.