Closed Junhano closed 3 years ago
@Junhano, since you're using a local image on iOS, is it possible the image you've loaded uses Apple's HEIF format? You may have to convert it to a supported format before calling decodeJpeg
.
@Junhano, since you're using a local image on iOS, is it possible the image you've loaded uses Apple's HEIF format? You may have to convert it to a supported format before calling
decodeJpeg
.
I did print out the URL and it ends with jpg
Could you try wrapping your arraybuffer in a UInt8Array similar to this example https://js.tensorflow.org/api_react_native/0.5.0/#decodeJpeg.
If that doesn't work could you upload a sample image file that shows this behaviour.
fixed
So I basically copy the same code from the doc (https://blog.tensorflow.org/2020/02/tensorflowjs-for-react-native-is-here.html) about using tensorflow in react native. However when I want to call decodeJpeg function it returns an error
Error: Expected image (JPEG, PNG, or GIF), but got unsupported image type getImageType@http://192.168.0.141:8081/index.bundle?platform=ios&dev=true&minify=false:377324:22
I tried different ways and don't know if my setup is wrong or the doc is wrong Below is what I tried (1)
(2)
the imageurl is from iPhone photo library so technically it's not from online but I think they should work the same. Do I need to show more setup?