It is safe to take a picture of the eclipse if it is protected. We recommend using a solar filter to prevent the intense sunlight from damaging your camera. Depending on the type of camera, these can either be attached to a lens or replace a lens entirely. The American Astronomical Society (AAS) has stressed the need to ensure that the filter is securely on to keep it from unexpectedly falling off during the event and potentially damaging your camera or eyesight.
The lens can be removed during the total eclipse to obtain an unobstructed image of the spectacle. But, like with solar glasses, it must be put back on as soon as the sun peaks around the moon to prevent damage.
A solar filter isn’t just photographers being overly cautious. After the eclipse of 2017, Lensrentals documented firsthand the damaging effects of not using a solar filter. It can result in lens iris damage, mirror damage, and melted sensors on cameras. These repairs can be costly, especially if you use a high-dollar DSLR or mirrorless camera, so it’s better to be safe than sorry.