Image/Video File Size to be used in Conditional Transformations

Hi!

Is there a URL transformation parameter that fetches the image/video file size for use in Conditional Transformations?

Thanks!

Hi

We currently dont support that. But if you can describe the problem you are trying to solve, and if needed, we can take this up as a feature request.

There are plenty of situations where knowing the file size of a given asset to then perform certain operations based on the value would be relevant. The most usual one would be to decrease the image size, for example, if the file size is X.

The way the default compression etc. work in ImageKit is that it will get you to something that is acceptable to standard tools like PageSpeed. If the original is heavily compressed, and you didn’t ask for any other transformation that could change the asset visually, then we do return the original variant itself. So, you can assume that you are getting the best possible variant in terms of size that balances speed and visual quality.

Hi, thanks for the context on how the default compression works, but that doesn’t quite cover my use case.

My requirement isn’t about general visual optimization or PageSpeed scores. I have specific logic where I need to evaluate the exact file size of an asset to conditionally trigger certain operations (like enforcing hard limits or applying aggressive resizing only when a file hits a specific byte threshold).

Since this isn’t currently supported, could you please log this as a feature request? Having the ability to use file size as a parameter in Conditional Transformations would be highly valuable.