Husband mission on a Saturday: mass conversion of HEIC images

I was helping my wife, who was trying to print some family photos, but the tool she was using only accepted JPG images, and most of her photos were in HEIC format.

Being the nerd that I am, I wasn’t satisfied with just running a local Python script to…


This content originally appeared on DEV Community and was authored by Evandro Pires

I was helping my wife, who was trying to print some family photos, but the tool she was using only accepted JPG images, and most of her photos were in HEIC format.

Being the nerd that I am, I wasn't satisfied with just running a local Python script to convert all the photos. I thought: this is a great opportunity to practice creating a serverless application that does this. Using the power of cloud computing, I imagined it was possible to convert all the images almost instantaneously—and I did it!

A serverless way to massively convert HEIC images to JPG almost instantaneously using S3 and Lambda.

Here's how I did it...

The Solution

Architecture using AWS services to massively convert HEIC images to JPG

The idea is simple. S3 is an object storage service where I can store any type of file at a low cost. S3 has an interesting feature called "Event Notifications." With this feature, I can "listen" for different events that occur in a bucket (the location where I upload files).

So, for each file I upload, an event is triggered, which then handles the conversion to JPG. For the conversion, I use a Lambda function. Lambda is a Function-as-a-Service (FaaS) component that allows you to run code without worrying about infrastructure. It’s scalable and you only pay for what you use.

This same Lambda function saves the JPG image to another S3 bucket, where I can download it.

The cool thing is that the conversion happens almost instantaneously. That’s because both S3 and Lambda are serverless services, meaning they automatically scale as needed.

How to use

Clone the following repository: https://github.com/epiresdasilva/heic-to-jpg

To deploy this solution I'll need:

  • An AWS account properly configured in our workspace
  • Python 3.9
  • Serverless Framework

Here is the step by step:

  1. Install python dependencies
pip install -r requirements.txt
  1. Deploy to AWS
sls deploy
  1. Access your AWS Console, go to the S3 session and upload your HEIC photos to the "heic-input-*" bucket.

  2. Go to the "jpg-output-*" bucket and download your converted files.

Results

I was able to convert all the images for my wife in seconds by uploading the files through the S3 upload interface and downloading them from the S3 bucket.

The estimated cost for this is $0.000002293 per image converted.

Curious fact: in 24 hours, without tell anyone, I had 20 clones of my repository.

About me

This is Evandro Pires. I'm a husband, father of two, but also a AWS Serverless Hero, Serverless Guru Ambassador, CTO, Podcaster and Speaker.

Serverless Guru thrives on innovation, collaboration, and continuous learning.

Join our team and help transform the digital landscape for companies worldwide!

https://serverless-guru-llc.breezy.hr/


This content originally appeared on DEV Community and was authored by Evandro Pires


Print Share Comment Cite Upload Translate Updates
APA

Evandro Pires | Sciencx (2025-02-25T00:12:03+00:00) Husband mission on a Saturday: mass conversion of HEIC images. Retrieved from https://www.scien.cx/2025/02/25/husband-mission-on-a-saturday-mass-conversion-of-heic-images/

MLA
" » Husband mission on a Saturday: mass conversion of HEIC images." Evandro Pires | Sciencx - Tuesday February 25, 2025, https://www.scien.cx/2025/02/25/husband-mission-on-a-saturday-mass-conversion-of-heic-images/
HARVARD
Evandro Pires | Sciencx Tuesday February 25, 2025 » Husband mission on a Saturday: mass conversion of HEIC images., viewed ,<https://www.scien.cx/2025/02/25/husband-mission-on-a-saturday-mass-conversion-of-heic-images/>
VANCOUVER
Evandro Pires | Sciencx - » Husband mission on a Saturday: mass conversion of HEIC images. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/02/25/husband-mission-on-a-saturday-mass-conversion-of-heic-images/
CHICAGO
" » Husband mission on a Saturday: mass conversion of HEIC images." Evandro Pires | Sciencx - Accessed . https://www.scien.cx/2025/02/25/husband-mission-on-a-saturday-mass-conversion-of-heic-images/
IEEE
" » Husband mission on a Saturday: mass conversion of HEIC images." Evandro Pires | Sciencx [Online]. Available: https://www.scien.cx/2025/02/25/husband-mission-on-a-saturday-mass-conversion-of-heic-images/. [Accessed: ]
rf:citation
» Husband mission on a Saturday: mass conversion of HEIC images | Evandro Pires | Sciencx | https://www.scien.cx/2025/02/25/husband-mission-on-a-saturday-mass-conversion-of-heic-images/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.