PNG-encode an image. `image` is a 3-D uint8 or uint16 Tensor of shape `[height, width, channels]` where `channels` is: * 1: for grayscale. * 2: for grayscale + alpha. * 3: for RGB. * 4: for RGBA. The ZLIB compression level, `compression`, can be -1 for the PNG-encoder default or a value f
(scope *Scope, image tf.Output, optional ...EncodePngAttr)
| 41479 | // |
| 41480 | // Returns 0-D. PNG-encoded image. |
| 41481 | func EncodePng(scope *Scope, image tf.Output, optional ...EncodePngAttr) (contents tf.Output) { |
| 41482 | if scope.Err() != nil { |
| 41483 | return |
| 41484 | } |
| 41485 | attrs := map[string]interface{}{} |
| 41486 | for _, a := range optional { |
| 41487 | a(attrs) |
| 41488 | } |
| 41489 | opspec := tf.OpSpec{ |
| 41490 | Type: "EncodePng", |
| 41491 | Input: []tf.Input{ |
| 41492 | image, |
| 41493 | }, |
| 41494 | Attrs: attrs, |
| 41495 | } |
| 41496 | op := scope.AddOperation(opspec) |
| 41497 | return op.Output(0) |
| 41498 | } |
| 41499 | |
| 41500 | // Decode the frame(s) of a GIF-encoded image to a uint8 tensor. |
| 41501 | // |