Mark Ku's Blog

Problem

While reviewing many e-commerce sites, I often noticed images of all sorts of sizes. Sometimes the uploader forgets to compress before uploading and ends up pushing a huge image. For users on a slow network, waiting for those images to load drags down page performance and the overall experience.

Solutions for oversized images

There are several ways to deal with oversized image files, such as:

  • Validate before upload in the admin panel
  • Cloud image storage APIs (e.g. Alibaba Cloud)
  • Cloudflare image resize API
  • Compress images at webpack bundle time
  • Manually compress image files

What is Imageflow

Today I want to introduce Imageflow, which I think is a great open-source image-processing project for .NET. It offers an image-adjustment API similar to Alibaba Cloud's. Through query strings, you can easily handle image format conversion, cropping, and compression. The frontend can pass parameters and have the backend transform the image before uploading it to your image storage. Or when fetching an image back, the query string can automatically deliver the format and size you want.

Open-source project Link Query command reference Link

Usage

Stylized image icon with neon swirls on a Starry Night background Spin up the project, tweak the image's query command, and the image size adjusts accordingly.

<img src="http://localhost:39876/demo_images/u3.jpg?w=300" />

<img src="" srcset="    http://localhost:39876/demo_images/u3.jpg?w=300 300w
                        http://localhost:39876/demo_images/u3.jpg?w=800 800w
                        http://localhost:39876/demo_images/u3.jpg?w=1600 1600w" />

Extended use cases

Responsive thumbnails

Responsive image srcset flow with Imageflow server and S3
Responsive image srcset flow with Imageflow server and S3
  1. The user uploads an image to Amazon S3 storage.
  2. A client visits your website.
  3. Based on the img element's srcset attribute, the browser loads the image at the appropriate resolution.

If you put Cloudflare in front of your Imageflow site, you can cache those dynamically queried images.

Author

Mark Ku

擁有 10+ 年經驗的資深軟體工程師,現為 AI 應用 Builder,專注於大型平台架構與簡化複雜系統設計,從電商系統到訂閱與收費平台,結合 AI Agent、AI 整合與自動化開發,打造高效率且可持續演進的產品技術基礎。Read More

Found this useful?

The author's free tools, daily podcasts and newsletter are all here.

Mark Ku · This article is licensed under CC BY 4.0. Credit the author and link back to the original when reusing it.

Comments

Subscribe to Newsletter

Subscribe to get new posts delivered instantly — never miss a tech share.

By submitting, you agree to receive emails. You can anytime.

Popular Posts

View all
Mark Ku
··602

Oracle Cloud Always Free Tier: Linux Host and Static IP for a $0 Cloud Solution

Oracle Cloud Always Free Tier: Linux Host and Static IP for a $0 Cloud Solution
Mark Ku
··490

Say Goodbye to Postman's Fee Trap! A Hands-on Guide to Bruno, the Open-Source Git-Native API Testing Powerhouse.

Say Goodbye to Postman's Fee Trap! A Hands-on Guide to Bruno, the Open-Source Git-Native API Testing Powerhouse.
Mark Ku
··333

A Free, Open-Source, Notion-like Knowledge Base — A Complete Guide to Deploying and Backing Up Outline Wiki

A Free, Open-Source, Notion-like Knowledge Base — A Complete Guide to Deploying and Backing Up Outline Wiki
Mark Ku
··264

Training Your Own AI Voice: Hardware Requirements, Open-Source Model Comparison, and LoRA Fine-Tuning

Training Your Own AI Voice: Hardware Requirements, Open-Source Model Comparison, and LoRA Fine-Tuning
Mark Ku
··221

Building an Efficient API Management Platform: Deploying Kong Gateway from Scratch - Part 1

Building an Efficient API Management Platform: Deploying Kong Gateway from Scratch - Part 1
Mark Ku
··215

Setting Up Samba on Ubuntu to Share Folders with Windows 11

Setting Up Samba on Ubuntu to Share Folders with Windows 11