Urgent.News

What's breaking now, across thousands of outlets.

Tech

How to Stamp a Transparent PNG Logo Across a Batch of Photos in Swift

If you need the same logo on thirty photos, the boring bugs show up immediately: the mark looks huge on a 12-megapixel still and timid on a 48-megapixel one, the PNG’s transparent background turns into a grey box, or the edges of the logo go muddy because the alpha channel was applied twice. This post walks through a small UIKit pipeline that loads a transparent PNG, draws each photo, then draws…

When you need the same logo on multiple photos, the process can become tedious if not handled properly. The logo may appear too large on a lower resolution image or too small on a high-resolution one. Additionally, the PNG's transparent background can turn into a grey box, and the edges of the logo can become fuzzy due to the alpha channel being applied twice. This guide outlines a simple UIKit pipeline for loading a transparent PNG, drawing it onto each photo, and sizing it based on the photo's shorter side.

To begin, you must load the logo as a UIImage from your bundle or a file URL. It is crucial to keep the PNG's alpha channel intact, as converting it to JPEG will result in a non-transparent rectangle. If you support user-picked logos from the photo library, ensure you request the original file to avoid accidental sticker effects caused by using a JPEG preview from a share sheet.

The logo's appearance is determined by three factors: its visual size, its distance from the edges, and how it sits on top of the photo. Instead of using a fixed pixel size, you should size the logo relative to the photo's shorter side. For example, using 18% of the shorter side as the logo's width ensures consistent visual weight across different photo resolutions.

The LogoStampSpec struct defines these three factors, allowing you to easily adjust the logo's appearance by changing its relative width, edge padding, opacity, and corner position. By creating a UIGraphicsImageRenderer with the pixel size of the image, you can draw the logo onto the photo in pixel space, maintaining the correct orientation and ensuring the logo appears as intended across all photos in the batch.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

This story

This is one outlet's version. Read the fullest account.

Read the original at dev.to →

More in Tech

Why your PDF signature breaks the moment someone edits the file

A client sent me a signed supplier agreement last month with a note: "we changed one date in appendix 2, that's fine right?" The signature panel in their viewer still showed a green tick.

  • PDF signatures verify file bytes, not content
  • Editing PDF shifts byte ranges, invalidates signature
  • Re-sign document after changes to maintain signature validity

ERC-2981 in practice: what a 5% royalty actually pays out

How an ERC-2981 royalty actually lands in a sale: in Seaport it is an extra consideration item with a fixed recipient, not a post-hoc transfer ERC-2981 does not transfer a royalty.

  • ERC-2981 royalty payout calculated via royaltyInfo function.
  • Seaport listing triggers royaltyInfo before signing order.
  • Seller net amount = price - royalty - marketplace fee.

Docker CI Jobs Need Cleanup Contracts

CI cleanup is usually treated as housekeeping. In a busy Docker pipeline, that is the wrong mental model. A container, temporary database, test inbox, or cloud runner left behind can change the next…

  • Docker CI jobs need structured cleanup approach
  • Assign unique run ID and owner to each resource
  • Implement external reaper for expired resources

5 Pricing Best Practices I Learned After Losing My Etsy Margins

I still remember the day I looked at my Etsy dashboard and felt a sudden pit in my stomach. I had just finished what I thought was a highly profitable month.

  • Etsy's fee structure includes 6.5% transaction, $0.20 listing, and variable payment processing fees.
  • A JavaScript script was created to calculate exact fees and separate fixed, variable costs.

Metabase Setup and API Surfaces Need More Than a Title Search

Metabase Setup and API Surfaces Need More Than a Title Search Metabase is often exposed as a reporting portal. The visible login page is only one part of the deployment.

  • Metabase setup requires thorough inventory beyond title search
  • API keys and SCIM provisioning manage user access
  • External inventory aligns Metabase with internal data sources

More from Sunday 8 November →