I usually eyeball it. Using fish I know the length of or based on the width of the tank to compare with. Or I’ll put a ruler against the glass and hope they swim past slow enough to see lol.
Gotten easy with the leporinus as he is half blind.
For a few fish I’m curious about, I’ll measure them after they die: