Jwillis gave you the right formula to approximate the capacitor you need.

Your transformer outputs 24v AC and has a certain VA rating (let's go with 50 VA since you don't mention it) ... with the example 50VA this means the AC current is 50VA / 24v = 2.08A

You can approximate how much DC current you're gonna have with the formula Idc = 0.62 x Iac ... in my example, that would be Idc = 0.62 x 2.08 = 1.29A

The 0.62 is a constant which works well with transformers in the 50..500 VA but it's just an approximation.

Anyway, the bridge rectifier (the four diodes) converts your AC to DC, and you get a peak DC voltage that's equal to :

Vdc peak : sqrt(2) x Vac - 2 x (voltage drop on diodes inside rectifier)

Most bridge rectifier diodes have a voltage drop of around 0.8v...1.0v so let's go with that...

So your 24v AC becomes a DC voltage with a peak of Vdc peak = 1.414 x 24 - 2 x 0.8 = 32.3v

The capacitor after the bridge rectifier makes sure the minimum voltage will be at least some value, at a particular current amount.

So let's say that with my example transformer (Vac = 24, Iac = 2.08 -> Vdc peak = 32.3 , Idc = 1.29A) we want at least 24v DC at 1.25A of current.

You can use that formula to approximate : Capacitance (Farads) = Current (A) / [ 2 x AC frequency x (Vdc peak - Vdc min desired) ]

With our numbers , C = 1.25A / 2x60x(32.3-24) = 1.25/996 = 0.0012550 Farads or 1255uF , so you'd probably want to use at least a 1500uF capacitor to guarantee the minimum of 24v at 1.25A.

At less than 1.25A of current draw, the minimum voltage will be closer to the peak DC voltage.

You can use more and that will raise the minimum voltage like I said but note that if you use too much, the capacitor will draw a lot of current when the circuit is turned on the first time (capacitor sucks in energy like a black hole for a few ms), so you'd have to be careful with fuses (use time delay, maybe use a temperature sensitive resistor to limit inrush current like computer power supplies do)

Also worth noting... with no load, all transformers but especially the low VA rating transformers output a higher voltage (10-15% extra is not unusual) but as there's some load applied the voltage sags down to the advertised voltage.

So keep that in mind when measuring things.