Published on

Image Optimization implementation in WebAPI

Authors

In this post, we will explore various implementation options available for an image server and discuss important design considerations associated with them.

Selection Checklist

The ideal image server should possess the following capabilities:

  • Efficient image optimization
  • Cross-platform compatibility
  • Swift processing speed
  • Open-source and free availability
  • Regular and active maintenance

Available options

Since our requirement is to have cross-platform compatibility, we cannot consider using CoreCompat.System.Drawing as it is not suitable for this purpose.

  1. ImageMagick
  2. Skia

1. ImageMagick

ImageMagick® is a free, open-source software suite, used for editing and manipulating digital images. It can be used to create, edit, compose, or convert bitmap images, and supports a wide range of file formats, including JPEG, PNG, GIF, TIFF, and PDF.

A .NET variant of ImageMagick® is Magick.NET. It is open-source and supported on multiple platforms.

The ImageMagick® library prioritizes quality over faster processing. As a result, it is slower than Skia. The .NET version of ImageMagick® is maintained by individuals with limited sponsorship.

  • ✅ Efficient image optimization
  • ✅ Cross-platform compatibility
  • 🆗 Swift processing speed
  • ✅ Open-source and free availability
  • 🆗 Regular and active maintenance

2. Skia

Skia is an open source 2D graphics library which provides common APIs that work across a variety of hardware and software platforms. It serves as the graphics engine for Google Chrome and ChromeOS, Android, Flutter, and many other products.

Skia is now part of the Chromium project and is well-maintained and performance-efficient. It is expected to have well-deserved support due to its integral release with the Chromium project. The .NET variant of Skia is maintained under the Mono project, making it more reliable.

Another advantage of Skia is that it is future-ready with WebAssembly support. This makes Skia a great choice for cross-platform image processing.

  • ✅ Efficient image optimization
  • ✅ Cross-platform compatibility
  • ✅ Swift processing speed
  • ✅ Open-source and free availability
  • ✅ Regular and active maintenance

Conclusion:

After careful consideration of the criteria we established, we have ultimately selected Skia as our preferred option. However, it is worth noting that if time is not a limiting factor and the focus is on achieving high-quality processing, ImageSharp may be favored.

References

A detailed comparison made by .Net community is here