TF has native functions to decode images loaded from files like decode_image() or decode_png()
Please, see this documentation page: tf.io.decode_image  |  TensorFlow Core v2.6.0 3
You can specify the number of channels that you need in a decoded tensor, which can be 1, 3, 4 or the same as in the original image.