In 2026, why are campaign posters in mini programs blurry on Android but clear on iPhone—did you set canvas width and height directly to 750 from the design file?
Blurry on Android but clear on iPhone is usually not a mistake in the drawing code. More often, the canvas bitmap size and its display size on the page are treated as the same value: width and height are set directly to logical values such as 750 from the design file, and a high-pixel-density Android device treats it as a low-resolution bitmap and upscales it to fill the screen, so text and thin lines tend to blur first. Based on 2026 project delivery experience, check these three items first—output target size, pixel ratio value, and compression in the export path—and then decide whether the drawing logic needs to change. In most cases this is less work than rewriting the whole block.
The canvas width and height and the width and height on the page are two different things
canvas has two size concepts: the tag attributes width/height determine how many pixels the actual bitmap has, and the CSS width and height determine how much space it takes on the page. The ratio between them is the clarity headroom of this image. If the ratio is 1, the rendering layer interpolates and enlarges a small bitmap to screen size, so edges naturally look soft; only when the ratio is close to the system's devicePixelRatio can detail be preserved.
iPhone pixel ratios are relatively concentrated, commonly between 2 and 3; Android models are much more scattered, with 2.0, 2.75, and 3.0 all appearing. The same canvas drawn at 750 wide must be enlarged nearly twofold on a 3.0 device—this is the common source of 'blurry on Android, acceptable on iPhone.' In 2026 mainstream screens are finer, and this gap will not disappear by itself.
When Android is blurry and iPhone is clear, check these places first
Before changing drawing code, go through the following order. Most problems can be traced to a specific step without overturning and rewriting the whole block.
- Bitmap size equals CSS size: the canvas is 1:1, which asks the system to interpolate; blur starts at this step.
- The asset itself does not have enough resolution: the design provides a 750-wide background but the final output needs 1080, which means using it enlarged; no scaling trick can recover it.
- Second compression in the export path: converting to base64 first, passing it to an image component, and setting a lower quality—clarity is lost at the last step.
- Looking only in developer tools: the simulator's pixel ratio often differs from a real device; conclusions must be based on real-device screenshots.
One reminder: looking clear on iOS does not mean the code is correct. Under some model combinations, default scaling happens to hide the details, and this will be exposed on a large-screen Android device or a foldable screen.
To align the two sizes, follow these steps
- Define the output target first: the long edge of a share image commonly falls in a typical range of 1080 to 1280 pixels. Then derive a logical coordinate system (for example, 375×667), and write all subsequent coordinates as logical values.
- Bitmap size = logical size × pixel ratio: it is advisable to cap the pixel ratio, commonly between 2 and 3, to avoid memory pressure on mid- and low-end devices caused by an oversized canvas.
- Set dimensions before scaling: setting canvas.width resets the drawing context. Reversing the order can easily cause nothing to draw or scaling errors.
- Draw everything in logical coordinates: write text, rounded corners, and avatar crop positions as logical values; let the context handle scaling uniformly. Do not multiply the pixel ratio at every point.
- Export the bitmap, do not take a screenshot: use the canvas's own bitmap, not a screenshot of page elements; the latter is more affected by layout and rounded-corner styles.
Among these five steps, the easiest to miss is the cap check in step two. If the pixel ratio is taken directly from the system value, canvas area on a 3.0 device is nearly 9 times larger. Add a large background image, and drawing lag and export failure will appear on low-end devices.
Where rework happened on a campaign poster with a 5-day schedule
A campaign page had only a 5-day schedule. Design provided only a 750-wide JPG background, and the requirement was for the same codebase to produce both an in-page preview image and a 1080 share image. Two days before launch, the small text in the share image was found to be blurry on a real Android device.
The constraints at the time were that design could not produce another version and the backend had no schedule to take on an image-generation service, so the fix had to be made in existing code. The approach was to fix logical coordinates at 375, cap the pixel ratio at 3, replace the background segment with higher-resolution assets plus redrawn vector elements, and align the QR code and avatar separately to integer pixels.
The cost was about half a day extra for real-device regression, comparing image by image on three Android devices with different pixel ratios plus one iPhone. The benefit was avoiding a round of rework after launch because the poster was blurry and had to be resent. In projects like this, reserving half a day to one day for real-device regression is a relatively safe experience range; squeezing it to zero often means paying for it after launch.
How to judge whether a poster is acceptable
The acceptance line should not be set as 'it looks okay.' A more stable approach is to save the exported image locally and view it at 1:1 rather than browsing a thumbnail: on a 1080-wide final image, body small text should have no obvious jagged edges, and circular avatars and rounded cards should have no burrs.
- Exported pixels: the actual file width and height reach the agreed values, not enlarged by CSS.
- 1:1 viewing: view at 100% and check text strokes and right-angle edges.
- Real-device comparison: compare screenshots from at least two Android devices with different pixel ratios plus one iPhone.
- Extreme content: verify extra-long nicknames, empty avatars, and QR codes flush to the edge separately.
- File size: share images over 1MB need an assessment of loading and upload time.
Front-end image generation, server-side image generation, and direct screenshots: cost and schedule comparison
For the same poster, different implementation paths bring considerable differences in cost and consistency. The following ranges are based on 2026 delivery experience and should be adjusted for team size and template complexity; they do not need to be matched word for word.
- Front-end canvas image generation: simple templates commonly take 0.5 to 2 person-days. The advantage is no backend dependency and the ability to go live after changing copy; the cost is font rendering differences across devices, which require real-device regression.
- Server-side image generation: commonly 3 to 7 person-days, plus server and font package costs. The advantage is higher consistency from the same configuration, suitable for batch and long-term reuse.
- Direct screenshot of the DOM: close to 0.5 person-day. The advantage is that the image comes out as soon as the page is written; the disadvantage is greater variation in fidelity for fonts, shadows, and gradients, making it more suitable for temporary campaigns.
The judgment can be reduced to one sentence: if templates are fixed, the schedule is tight, and only one or two images are needed, front-end image generation is enough; if there are many templates, cross-platform consistency is required, and archival reuse is needed, server-side image generation is more stable. The two are not either-or; a common approach is front-end preview plus server-side official share image.
Applicable and non-applicable boundaries
Suitable for self-drawing: marketing share images, report cards, invitation cards with QR codes—where fields are fixed, the number of templates is small, and the launch cycle is measured in days. Front-end image generation has low iteration cost; changing copy and rebuilding is enough.
The non-applicable cases should also be made clear: scenarios that require print-level output, layouts that vary greatly with content (long articles, irregular mixed text and images), or strict pixel review requirements are better handed to design tools or server-side image generation. Taking a screenshot of the entire page simply to save effort means that when the page is redesigned or styles change, image output will fluctuate and maintenance cost will be higher. Whether to adopt a high-definition approach also depends on the delivery channel—posters only previewed as small images in a chat window have limited value from excessive enlargement.
FAQ
Can mini program canvas code be copied directly from web canvas code?
The idea is the same, but node selection, context retrieval, and export APIs are different. On the mini program side, choose the corresponding APIs according to the official documentation; web code cannot be copied over as a whole.
On iPhone it is clear, on Android it is blurry—is font rendering to blame?
Font differences can amplify the perception, but the main cause is usually that the bitmap size was not enlarged according to the pixel ratio. Check the export width and height first, then look at fonts and assets.
Rounded avatar edges on the canvas have burrs. What should be done?
A common approach is to draw in the scaled coordinate system, place the center and radius at integer or half-pixel positions, and if necessary add 0.5 to the radius and check again.
What size should the exported share image be, and will it be too large and slow to load?
A common range is 1080 to 1280 pixels on the long edge. Try to keep the file under 1MB, then verify loading and sharing time on real devices.
The preview in the page is clear, but the saved image is blurry. Where is the problem?
It is most likely stretched or compressed again during saving. Check the actual pixel dimensions before and after saving, then see whether format conversion reduced quality.
Before starting, do three things: write the target output size as an acceptance item, put the pixel ratio cap into a code constant, and prepare two Android devices with different pixel ratios for regression. If poster templates will keep increasing, or if the same layout configuration must be shared with the backend, evaluate server-side image generation according to enterprise project delivery habits; when teams deliver such campaign pages, they usually align the size criteria for preview and share images in advance to avoid later rework. When the scenario is simple and only one or two images are needed, the front-end approach is already sufficient, and there is no need to introduce a separate image-generation service for it.
-
If an API occasionally returns null and a product card prints “null,” should the fallback live in data fetching or rendering?
Date: Nov 22, 2026 Read: 8
-
In admin lists, when a product name gets long, the Edit/Unpublish button is pushed off screen—should the ellipsis go on the title or the outer container?
Date: Nov 21, 2026 Read: 8
-
In 2026, AI-generated pages work fine on the normal path, but what happens when the network drops, users click repeatedly, or they hit back? Are these edge states the frontend team's job?
Date: Nov 20, 2026 Read: 18
-
In 2026, product says only “make it a bit smoother” before a project starts—then brings up experience before launch. Who should kick off the experience target sheet?
Date: Nov 19, 2026 Read: 12
-
A coupon pop-up is still open in WeChat, but pressing Back on the phone exits the whole campaign page—who should own the Back button?
Date: Nov 18, 2026 Read: 20




