You don't have an iMac that so special like that. (Please
correctly identify your model, so others can point to the most optimal solution
)
It was discussed
before in this forum and
many places on the internet (10 years ago, wow) that
capacitor plague that affected the entire industry and specially the first models of iMac G5, so the rule was: If your machine (considering the first models, ok?) didin't failed, it's just a matter of time before it happens."
Usually computers problems(and Mac's are included for obvious reasons) have 2 major causes:
1) Software
2) Hardware
On regards to the software side, unless you could install, tweak and modify the O.S. so heavily that can make the hardware misbehave, usually you are on the safe side since I think that you aren't that irresponsible/adventurous.
A) On the Hardware side specifically to the iMac G5 there was the capacitor plague that
make Apple fix their mistakes. And as far as I know this problem only affects the first generation of iMac G5, the ALS had some few reports and the iSight I never heard (but we only know what others have reported, right?)
B) You can have also a degrading GPU because it operates too hot for too long that the silicon degraded and you'll have artifacts on your image. So to proper diagnose you should test it connecting to an external monitor so you can discard an LCD or LCD cable fault.
C) Since it it's a video problem could also be an GPU memory problem, but that would involve replacing the GPU memory, and isn't a easy thing to do.