Skip to content

Commit e8281a1

Browse files
committed
Support more image formats on Android
1 parent 7d64419 commit e8281a1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/google_mlkit_commons/android/src/main/java/com/google_mlkit_commons/InputImageConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static InputImage getInputImageFromData(Map<String, Object> imageData,
3737
(int) (double) metaData.get("width"),
3838
(int) (double) metaData.get("height"),
3939
(int) metaData.get("rotation"),
40-
InputImage.IMAGE_FORMAT_NV21);
40+
(int) imageData.get("image_format"));
4141
return inputImage;
4242
} else {
4343
result.error("InputImageConverterError", "Invalid Input Image", null);

packages/google_mlkit_commons/lib/src/input_image.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ class InputImageMetadata {
6262

6363
/// Format of the input image.
6464
///
65-
/// Not used on Android.
65+
/// Android only supports
66+
/// - [InputImageFormat.nv21]
67+
/// - [InputImageFormat.yuv_420_888]
68+
/// - [InputImageFormat.yv12]
69+
/// as described in [here](https://developers.google.com/android/reference/com/google/mlkit/vision/common/InputImage.ImageFormat).
6670
final InputImageFormat format;
6771

6872
/// The row stride for color plane, in bytes.

0 commit comments

Comments
 (0)