No municipality or county shall publicly release a photograph of a peace officer who is the subject of an investigation without the written permission of the peace officer, except that the municipality or county may display a photograph of a peace officer to a prospective witness as part of an investigation and the municipality or county may provide a photograph of a peace officer to the investigating individual to display to a prospective witness as part of the investigation. This section does not apply to any municipality or county accredited through the Commission on Accreditation for Law Enforcement Agencies.