Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions tfjs-node/src/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export enum ImageType {
*
* @param contents The JPEG-encoded image in an Uint8Array.
* @param channels An optional int. Defaults to 0. Accepted values are
* 0: use the number of channels in the PNG-encoded image.
* 0: use the number of channels in the JPEG-encoded image.
* 1: output a grayscale image.
* 3: output an RGB image.
* @param ratio An optional int. Defaults to 1. Downscaling ratio. It is used
Expand Down Expand Up @@ -73,7 +73,7 @@ export function decodeJpeg(
/**
* Decode a PNG-encoded image to a 3D Tensor of dtype `int32`.
*
* @param contents The BMP-encoded image in an Uint8Array.
* @param contents The PNG-encoded image in an Uint8Array.
* @param channels An optional int. Defaults to 0. Accepted values are
* 0: use the number of channels in the PNG-encoded image.
* 1: output a grayscale image.
Expand Down Expand Up @@ -153,7 +153,7 @@ export function decodeGif(contents: Uint8Array): Tensor4D {
* @returns A Tensor with dtype `int32` and a 3- or 4-dimensional shape,
* depending on the file type. For gif file the returned Tensor shape is
* [num_frames, height, width, 3], and for jpeg/png/bmp the returned Tensor
* shape is []height, width, channels]
* shape is [height, width, channels]
*/
/**
* @doc {heading: 'Operations', subheading: 'Images', namespace: 'node'}
Expand Down Expand Up @@ -301,6 +301,7 @@ export function getImageType(content: Uint8Array): string {
return ImageType.BMP;
} else {
throw new Error(
'Expected image (JPEG, PNG, or GIF), but got unsupported image type');
'Expected image (BMP, JPEG, PNG, or GIF), but got unsupported ' +
'image type');
}
}
2 changes: 1 addition & 1 deletion tfjs-node/src/image_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ describe('decode images', () => {
} catch (error) {
expect(error.message)
.toBe(
'Expected image (JPEG, PNG, or GIF), ' +
'Expected image (BMP, JPEG, PNG, or GIF), ' +
'but got unsupported image type');
done();
}
Expand Down