retrieveBitmap previously returned bitmaps sized to the image content (e.g.
1994x2992 for FIT on a portrait image), leaving the launcher to scale/position
them — which silently broke the chosen scaling mode:
FIT → narrower than canvas → launcher scaled up → cropped height again
FILL → taller than canvas → launcher behaviour undefined / distorted
NONE → smaller than canvas → launcher stretched it
New finalizeToCanvas() step ensures every path returns a bitmap of exactly
canvasW×canvasH pixels:
FILL → center-crop the fill-scaled source to canvas size;
upscale first when BitmapFactory fallback returns a small source
FIT → center the fit-scaled source on a black canvas (letterbox/pillarbox)
NONE → center the original-size source on a black canvas
STRETCH → source was decoded to exact canvas dimensions; no-op
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>