- #1
BRN
- 108
- 10
Hello!
For my project I need to converting some images from grayscale to RGB using Tesorflow. My code is this:
but I receive this error:
I can't understand what the problem is. Can someone help me?
Thank you
For my project I need to converting some images from grayscale to RGB using Tesorflow. My code is this:
converting images from grayscale to RGB:
image_grayscale = tf.io.read_file('image_bw.png')
image_grayscale = tf.image.decode_png(image_grayscale, channels=1)
image_grayscale = tf.convert_to_tensor(image_grayscale[:,:,:3])
image_rgb = image.grayscale_to_rgb(image_grayscale)
tf.io.write_file('image_rgb.png', tf.image.encode_png(image_rgb))
but I receive this error:
error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/tmp/ipykernel_2762/1709057148.py in <module>
----> 8 image_rgb = image.grayscale_to_rgb(image_grayscale)
10 tf.io.write_file('image_rgb.png', tf.image.encode_png(image_rgb))
~/.local/lib/python3.9/site-packages/PIL/Image.py in __getattr__(self, name)
515 deprecate("Image categories", 10, "is_animated", plural=True)
516 return self._category
--> 517 raise AttributeError(name)
518
519 @property
AttributeError: grayscale_to_rgb
I can't understand what the problem is. Can someone help me?
Thank you