MCPcopy Index your code
hub / github.com/tensorflow/tfjs / encodeJpeg

Function encodeJpeg

tfjs-node/src/image.ts:220–233  ·  view source on GitHub ↗
(
    image: Tensor3D, format: ''|'grayscale'|'rgb' = '', quality = 95,
    progressive = false, optimizeSize = false, chromaDownsampling = true,
    densityUnit: 'in'|'cm' = 'in', xDensity = 300, yDensity = 300,
    xmpMetadata = '')

Source from the content-addressed store, hash-verified

218 * @doc {heading: 'Operations', subheading: 'Images', namespace: 'node'}
219 */
220export async function encodeJpeg(
221 image: Tensor3D, format: ''|'grayscale'|'rgb' = '', quality = 95,
222 progressive = false, optimizeSize = false, chromaDownsampling = true,
223 densityUnit: 'in'|'cm' = 'in', xDensity = 300, yDensity = 300,
224 xmpMetadata = ''): Promise<Uint8Array> {
225 ensureTensorflowBackend();
226
227 const backendEncodeImage = (imageData: Uint8Array) =>
228 nodeBackend().encodeJpeg(
229 imageData, image.shape, format, quality, progressive, optimizeSize,
230 chromaDownsampling, densityUnit, xDensity, yDensity, xmpMetadata);
231
232 return encodeImage(image, backendEncodeImage);
233}
234
235/**
236 * Encodes an image tensor to PNG.

Callers

nothing calls this directly

Calls 2

ensureTensorflowBackendFunction · 0.90
encodeImageFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…