It sounds like you have either a bad Video Graphics card, or bad capacitors on your logic board. And either of these problems can be difficult, expensive, or not even feasible repairs.
If either of these turns out to be the correct scenario, and you have pictures, music, videos, TV shows, contacts, or other important documents you want to save, your two best alternatives are get a new iMac, and either:
1) Restart your current iMac in what is called Target Disk Mode, then connect it to your new iMac with a FireWire cable to transfer your pictures, music, etc. to the new device.
2) Have the internal hard drive removed from you iMac, placed into an external enclosure, then connect it to your new iMac.
But before we get to that point, let's try a few things:
If you have any G5 iMac model EXCEPT the iSight version, you can inspect the capacitors yourself. Watch this video on upgrading your iMac's RAM to show you how to remove the back of your iMac, if you don't already know how:
While you have the back off, use a can of compressed air to blow the dust out the vents at the bottom of the iMac, the fans, and anywhere else you can. Now inspect the 28-30 capacitors on the logic board. The capacitors stand up on the logic board like tiny little cylinders. There will be a bunch of them together, then 4 or five off to the side. The tops of the capacitors should be shiny. Look for dark spots, or if they look puffy or swollen, or leaks.
A visual inspection won't help in determining if the graphics card is bad, unfortunately.
Reset the SMC by removing all cables (USB, FireWire, Ethernet, Modem, Power cord) from the back of your computer. Let it sit for one minute. (Already done if you did the first step). Press and hold the power on button on the back of the iMac while plugging in the power cord. Release the power on button. Count to five, the press the power on button again.
Reset your PRAM. Press and hold down the Command Option P R keys while starting your computer. You will hear the startup chime. continue holding down those keys until you hear the startup chime a second time. Release the keys. If the computer restarts, you will need to reset your Date and Time. It might be time to replace your PRAM battery. The G5 iMacs require a 3 volt CR2032 lithium watch/camera battery like below:
You can find these batteries at Walmart, Kmart, Target, most local drugstore chains, for between $3-$5, or at Radio Shack for $12-$20.
If you have any G5 iMac model EXCEPT the iSight version, you can probably do the battery install yourself. Watch the video I linked above, to see how to open the back cover.
Perform an Apple Hardware Test on your iMac.
Insert the original, came with the iMac when it was brand new, Install Disc 1 DVD into the optical CD/DVD drive. If your computer is on, restart your Mac by selecting Restart in the Apple Menu.
Immediately press and hold the Option key on the keyboard. This invokes the Startup Manager. Release the Option key after the Startup Manager appears on your display.
When the wristwatch progress indicator disappears - indicating the Startup Manager's scan for bootable volumes has completed - select the Apple Hardware Test volume.
Click the right-pointing arrow. Your Mac will startup from the Apple Hardware Test volume.
Write down anything it reports.
Place your original, came with the iMac when purchased install disk, into the optical drive slot on the iMac. Restart the computer. Immediately press and hold the C key. (If you have upgraded your OS from when you purchased your iMac, example your iMac came with OS 10.3 installed, and you're now using OS 10.5, then use the OS 10.5 Retail Install disk that you had used to upgrade your OS instead of the original, came with the iMac disk.)
Release the C key when the spinning gear below the dark gray Apple logo appears. Wait for the installer to finish loading. DO NOT do an OS installation. After the installer loads select your language and click on the Continue button. When the menu bar appears at the top screen, click on Utilities, and pull down to select Disk Utility. On the left side of the window that opens, select your normal hard drive entry (manufacturer's ID and drive size). In the lower portion of the Disk Utility window you will see an entry for the S.M.A.R.T. status of the hard drive. If it does not say Verified, then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.)
If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid at the top middle of the window if it isn't already selected. Now click the Repair Disk button from the lower right area of the window. If the disk utility reports any errors that have been fixed, then re-run Repair Disk again, until no errors are reported. When that is done, click the Repair Permissions button to the left of the Repair Disk button you clicked earlier.
When that is done, quit Disk Utility.
If Disk Utility reports errors it cannot fix, then you will need DiskWarrior and/or Tech Tool Pro to repair the drive. These are third-party disk repair utilities that cost money. If you don't have them, Google them for more info. If neither of them can fix the drive, you will need to backup your data as described earlier, and reformat the drive and reinstall the OS X.
From the top Menu bar (I think its under Utilities) select the Start Up Manager, and choose your normal boot volume as the startup disk. Restart the computer. If successful, and you've rebooted from your normal startup disk, eject the install DVD/CD, and you're good to go.