bamlab/react-native-image-resizer

WEBP format doesn't work on iOS?

Reagankm opened this issue · 4 comments

I'm using "@bam.tech/react-native-image-resizer": "^3.0.4", and I call the resizer like this:

export const resizeImageToMax = (uri: string): Promise<ResizerResponse> => {
    return ImageResizer.createResizedImage(
        uri,
        photoUploadMaxWidth,
        photoUploadMaxWidth,
        'WEBP',
        100,
        0,
        undefined,
        false,
        { onlyScaleDown: true }
    );
}

On Android it works fine. On my iOS emulator I get this error:

 WARN  Possible Unhandled Promise Rejection (id: 1):
Error: Can't save the image. Check your compression format and your output path
Error: Can't save the image. Check your compression format and your output path
    at promiseMethodWrapper (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.CupbearerApp:2383:45)
    at createResizedImage (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.CupbearerApp:126355:43)
    at resizeImageToMax (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.CupbearerApp:126293:63)
    at anonymous (http://localhost:8081/organisms/modals/EditPhotoModal.bundle?platform=ios&modulesOnly=true&app=org.reactjs.native.example.CupbearerApp&dev=true&minify=false&runModule=true&shallow=true:113:95)
    at tryCallOne (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:53:16)
    at anonymous (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:139:27)
    at apply (native)
    at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.CupbearerApp:30411:26)
    at _callTimer (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.CupbearerApp:30311:17)
    at _callReactNativeMicrotasksPass (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.CupbearerApp:30346:17)
    at callReactNativeMicrotasks (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.CupbearerApp:30554:44)
    at __callReactNativeMicrotasks (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.CupbearerApp:2810:46)
    at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.CupbearerApp:2588:45)
    at __guard (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.CupbearerApp:2793:15)
    at flushedQueue (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.CupbearerApp:2587:21)
    at invokeCallbackAndReturnFlushedQueue (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.CupbearerApp:2580:33)

If I change the format to 'JPEG' then it works on iOS, but I really want to use WEBP, especially since it is supported natively as of iOS 14.

@Reagankm

As specified in the README, WEBP format is at the moment only supported on Android:

| compressFormat | Can be either JPEG, PNG or WEBP (android only). |

Any contribution is welcome 🙂

Ah. Sorry, I missed that. I went a different way for my resizer library, but I appreciate the work you've put into this. It seems like a great utility

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale commented

This issue has been automatically closed. Thank you for your contributions.