I was out taking pictures and after taking a picture of the sun, I took this one and it turned green, and I have no idea how I managed to pull it off.
If you look you'll see that the off-colour parts are at the lower end of the brightness range ( darker ) and their is also evidence of a flare on the right hand side of the image.
The combination of these things probably threw your auto white balance off a bit and the darker pixels, which are more prone to error anyway, got thrown off the most. This has led to your odd looking colours.
How to combat these things :
Use a hood. Always. I'm guessing you did not based on the flare. A hood would probably have eliminated that.
Don't expect auto settings to work. If you want to get the result you expect, shoot RAW ( where you choose white balance during raw conversion ) and expect the odd problem in difficult situations.
If you use a so-called protective filter, remove it and keep it off unless you;re shooting in hostile conditions. These things make flares and other optical issues more likely.
If you shoot JPEG, choose a white balance setting. Do not rely on auto white balance. One reason to shoot RAW is that in JPEGs you cannot always undo the white balance if its wrong. With RAW you get the maximum scope to adjust white balance. Many cameras allow RAW+JPEG and this is a useful choice if you just want the RAW for occasional use and you can ignore it or delete it if the JPEG turns out OK for your needs.
IF the photo was taken at sunset almost exactly as the direct view of the sun vanished then you MAY have inadvertently caught the "green flash" which occurs as the sun sets.
This is a hard to photograph phenomenom and can be as vivid as your photo shows - but usually isn't.
If this IS a "green flash" you have got an extremely good one.
As a confirmation, if you took several close together and the ones before and after this were not green then it increases the likelihood that this was a solar "green flash".
Here is the start of an explanation from the first link below:
- Green flashes are by-products of the large variations in astronomical refraction near the horizon. Although there are several kinds of green flash, almost every kind is a by-product of a corresponding mirage. All the common forms are magnified images of the green rim produced by dispersion in the bulk of the atmosphere. The rim is too narrow to be seen without magnification, but sufficient magnification can be produced by mirages of various kinds. ....
Another possibility is that a reflection shone bright green light on some or all of your lens and it refracted through the optics in unpredictable ways. I have seen similar to this happen. A green LASER pointer works marvels. (Warning: do not look into beam with remaining good eye :-( !)
Here is a very good example. This is claimed genuine and explained in detail by the photographer. Usually they are not this bright or large. From here
This is better than most and lists other explanations which he says are less good here.
NASA brief explanation
Somebody's results after years of trying here
A few zillion examples - beware of fakes.
A different sort of green flash.
The specular pattern on the image makes it obvious that this is coherent (LASER) light (if there was any doubt).
The manner in which the beam has "got into the optics" in unpredictable ways is evident in both images but especially in the lower one. (Needless to say, most of the images did not look like this). While you will not have had a LASER shining into your lens, this is what bright light on the lens can do.
Warning: Green LASER pointers are often greater or much greater power than the "eye safe" class one units. Significant eye damage can occur.
All "firearms" were pointed with my permission (and instruction).
(Airsoft guns, photographer 'armoured', shooters sensible, stuff can still happen).