If it's a PowerPC iMac with an LCD display (and not a MUCH older iMac with a CRT), the cause may be the CCFL backlighting for the LCD. These "cold-cathode fluorescent lamps" are similar to the "tubes" that light most office buildings, which also start to flicker with age. If this flickering causes the content on screen to distort or change, then the cause is something else...
You may want to try resetting the iMac's "power management." This is called the PMU, SMU, SMC, and other names, depending on the specific iMac model. There are specific instructions for resetting this part on the iMac, depending on iMac model. If you can post back with the exact iMac model, I can link to the procedure document. Here is a list of all iMac models, if you need help with ID'ing your iMac model.
Also, if the iMac is currently plugged into an old or over-crowded "power strip," you should try connecting it directly to a wall outlet to see if that makes any difference.
OK, that's an Intel-based iMac (not PowerPC), but it's old enough to have CCFL backlighting (not the more recent LED backlighting), so what I wrote previously is relevant.
This is the procedure to reset the SMC on an Intel-based iMac
It's basically unplugging the iMac and plugging it back in a specific way. Be sure to try connecting it directly to a wall outlet when plugging back in, to see if that makes any difference. Also, you should disconnect all cords and cables from the iMac and start it up with only the power cord connected. Then, add only a standard USB keyboard and mouse (unless you use wireless). Use it that way for a while to see if there is improvement.