Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Resize and 0 padding using tensorflow
tf_image =, channels=3)
tf_image = tf.compat.v1.image.resize_image_with_pad(tf_image, 256, 512)
out = tf.cast(tf_image, tf.uint8)
out = tf.image.encode_jpeg(out, format="rgb", quality=100)
# out ="test.jpeg", out)
with tf.Session() as sess:
jpeg_byte =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.