Classifying images by pixel dimensions

Started by sybersitizen, July 14, 2023, 06:50:43 PM

Previous topic - Next topic

sybersitizen

I'd like to set up a Category to identify images that are too small for some purposes - for example, ones that are less than 50 pixels wide or 50 pixels high. It should be easy to do, but I'm having trouble figuring out the exact syntax.

Can you help?

Mario

#1
A data-driven category based on a variable will do this. For example:

{File.ShortEdge|cast:int;numcomp:lt,1000,Too Small,OK}

This variable

a) uses cast to convert the file shorter of the width/height into a number (removes the formatting like thousands groups)
b) uses numcomp to check if the width is < 1000. If this is the case, it returns "Too Small" else it returns "OK".

Replace 1000 with whatever minimal size you require.

If you use this variable to create a data-driven category using these settings:

Image3.jpg

you get a neat category that classifies your files into "Too Small" or "OK", depending on the width:

Image2.jpg

And since this is a normal category, you can use it for filtering or other purposes.

Note: If your database is large and you don't need this often, set the category to manual update.

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sybersitizen


Mario

Good result :)

IMatch is very powerful and makes even such rather unusual tasks easily doable.
If you like IMatch, let others know about it.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook