Loss of Image Information

Solution for Loss of Image Information
is Given Below:

When reading a JPEG image from a TFRecord there seems to be loss of information. Here is an example:

The tf.data.Dataset was created using the Keras image_dataset_from_directory function and, each image tensor of shape 600x600x3 was encoded to a byte string using the tf.io.encode_jpeg:

image = tf.image.convert_image_dtype(image_tensor, dtype=tf.uint8)
image = tf.io.encode_jpeg(image, quality=100)

Each TFRecord example was created like this:

    # encoded_image is the output of encode_jpeg function
    image_feature = tf.train.Feature(
    features = tf.train.Features(feature={
        'image': image_feature
    example = tf.train.Example(features=features)
    return example.SerializeToString()

And below is the code that loads the TFRecords Dataset, using tf.image.decode_jpeg to decode the images back to tensors of shape 600x600x3, and then saves one image to disk using PIL:

def read_tfrecord(example):
    tfrecord = {
        "image": tf.io.FixedLenFeature([], tf.string)
    example = tf.io.parse_single_example(example, tfrecord)
    image = tf.image.decode_jpeg(example['image'], channels=3)
    return image

def read_dataset(dataset_path):
    filenames = tf.io.gfile.glob(dataset_path + '/validation/*.tfrecord')

    dataset = tf.data.TFRecordDataset(filenames)
    dataset = dataset.map(read_tfrecord)
    dataset = dataset.repeat()
    dataset = dataset.batch(128)

    for image, label in dataset.take(1):

I have absolutely no clue what is causing this apparent loss of image information so any help would be much appreciated!