Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. tf_image = tf.io.decode_image(image, channels=3)
  2. tf_image = tf.compat.v1.image.resize_image_with_pad(tf_image, 256, 512)
  3.  
  4. out = tf.cast(tf_image, tf.uint8)
  5. out = tf.image.encode_jpeg(out, format="rgb", quality=100)
  6. # out = tf.io.write_file("test.jpeg", out)
  7.  
  8. with tf.Session() as sess:
  9. jpeg_byte = sess.run(out)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement