A large and diverse group of procaryotic and eucaryotic organisms that have in common the production of energy by photosynthesis; they range in size from microscopic to several metres; most are free living, but some are symbiotic.