Cloudflare Images vs KV Storage

I find Workers and the KV Storage very useful and powerful but I haven’t integrated my images into the ecosphere and am wondering:

Which would be better? KV Storage or Cloudflare Images, for images that form the backbone of Wordpress sites?

I assume CF Images is geared specifically for such a use case and KV Storage is not?

Would that be the simplest answer? Or is there more to it?

How do you upload to CF Images? Via a webpage or Wrangler or how?

KV and Images differ quite a bit so I will do a comparison of them which should help you decide (note: Pricing is based on the paid Workers plan Bundled):

Price

Images:

  • Pre-pay for storage ($5 per 100,000 images)
  • $1 per 100,000 served

KV:

  • 10 million Worker calls a month included then $0.5/m after
  • 1GB storage included then $0.5/GB
  • 10 million reads included then $0.5/million

Features

Images:

  • You can define sizing for images (variants) to make sure you’re reducing bandwidth.
  • It will try to serve more modern formats when it can (like WebP and AVIF).

KV:

  • If you pay for Imae Resizing then you can dynamically resize through a Worker

Limits

Images:

  • Can only store images up to 10MB
  • Does not support AVIF or JXL uploads
  • Only 20 variants can be created

KV:

  • Can only store images up to 25MB
  • No image resizing available without the Image Resizing product (or maybe through Rust)
  • You’d need to upload all different image formats and try to serve the right one yourself (if you wanted better formats like AVIF)

Performance

Images: Images using tiered caching, a high chance for images to be in the cache if you have an alright number of image hits
KV: You can utilize the Cache API in an attempt to keep the images in cache for as long as possible but the cache API and KV cache are only in that colo (not globally!)

Overall

A Worker using KV or Images can both be great for this. If you don’t have a lot of images and aren’t getting a lot of hits then Workers will be the cheaper option. If you do get a lot of image hits, Images may be cheaper (though I haven’t done the math). At the very least though, Images provides a much nicer way to upload and handle images.

I wouldn’t say either is better, it just depends on what you need. KV also can store any file which is super nice for a general storage (R2 may be better suited though when released).

3 Likes

Thanks for such a thorough reply!
I’ll have to do some analysis on costs with that info, very helpful to see them side by side so thank you!

One final Q:
How do we upload images to Images?

Several methods are documented here:
https://developers.cloudflare.com/images/upload-images

1 Like

This topic was automatically closed after 15 days. New replies are no longer allowed.