Why can tf.image.decode_jpeg decode a png?
The documentation for tensorflow states:
This op also supports decoding PNGs and non-animated GIFs since the interface is the same, though it is cleaner to use tf.image.decode_image.
So essentially it was a design decision that because the interface is the same to just handle it, rather than throw an error that forces user to use the correct API call.