If you create a photograph in which software code is a prominent feature, then your photograph will likely be considered to be a derived work of the software and you will have to comply with the copyright license of the software.
If the photograph is more than a mechanical reproduction of the source code, then the photograph itself is also protected by copy rights, which you hold as being the photographer.
If the source code is licensed under a permissive license, like the MIT license, then you are completely free in your choice of license for the photograph.
To comply with most permissive licenses, you will have to mention somewhere (probably in the metadata of the photo) that the code shown is licensed under license XYZ.