Menu

1 / 2

Crop Once, Post Everywhere: Batch Aspect-Ratio Crops for Social Images in Swift

DEV Community: swift·Maxwell·10 days ago
#WHkb5TiW
#devtoswift#devto#dev#crop#ratio
Reading 0:00
15s threshold

If you ship photos from an iPhone app to more than one place, you eventually hit the same boring problem: Instagram wants 1:1 or 4:5, a shop banner wants 16:9, Stories want 9:16, and the camera roll is full of 4:3 and 3:4 stills. Doing that crop by hand for thirty product shots is how afternoons disappear.

This post walks through a small UIKit pipeline that takes one UIImage , a list of target aspect ratios, and returns one centre-weighted crop per ratio — suitable for running across a whole album. I’m writing it from the seat of someone who builds BatchMark , an on-device batch photo app, where “apply the same finishing step to many photos” is the whole product.…

Continue reading — create a free account

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