Using ImageJ to automatically set scale by detecting a scale bar in the photo

Is it possible to use an ImageJ macro to detect a scale bar in an image and automatically set the scale to that predetermined scale?

Good day,

you may have a look at this post:
(Requires black scale-bars on white ground, etc.)

If you’re not happy with this approach, then please post a typical image in PNG- or TIF-format that shows a relevant scale bar.



I am trying to get imageJ to automatically detect scale bars like this one and use that set the scale for the image. I have photos with variable scale bars, with different units, which are printed below the scale bar.


Do you want IJ to find the scale bar and also “read” the units as well? I do not believe you can do this in a completely automated way.

Yes, that is what I was hoping for! Too bad it can’t be automated. Thanks anyways!