Menu

Why Your Watermark Is Tiny on One Photo and Huge on the Next: Resolution-Independent Overlays in Swift
📰

Why Your Watermark Is Tiny on One Photo and Huge on the Next: Resolution-Independent Overlays in Swift

DEV Community: ios·Maxwell·13 days ago
#XXsqVAKq
#devtoios#devto#dev#size#height
Reading 0:00
15s threshold

The obvious first version of batch watermark code has one setting that looks completely reasonable: a font size of 48.

On a screenshot that's enormous. On a 48-megapixel photo it's a speck in the corner you'd need to zoom in to find. On a portrait photo it sits at a different distance from the edge than on a landscape one. Every photo in the batch gets "the same" watermark, and no two of them look alike.

The bug isn't in any single line. It's the idea that a watermark has a size in points. When you're stamping a mixed set of images (phone photos, screenshots, crops, panoramas, images saved from chat apps), the only size that means anything is a size relative to the image.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.