Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openCropper result resolution incorrect on iOS #2122

Open
maxximee opened this issue Jan 6, 2025 · 0 comments
Open

openCropper result resolution incorrect on iOS #2122

maxximee opened this issue Jan 6, 2025 · 0 comments

Comments

@maxximee
Copy link

maxximee commented Jan 6, 2025

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.41.6
  • react-native v0.75.4

Platform

  • iOS

Expected behaviour

Resolution of cropped image is correct.

Actual behaviour

  • Resolution of ios cropped image is very small (eg 150x200) if no height/width is set.
  • Ratio is broken is height/width are set (it will always keep the height/width parameters with any cropped values).

Steps to reproduce

  1. Call cropper with predefined image (I use "react-native-vision-camera": "^4.6.3" to take the picture)

  2. Don't set width and height (because we don't want a fixed resolution. I the user crops the resolution of the output will not fit the ratio).

  3. On android, the result makes sense (eg 1080x2400 for a portrait picture), but on iOS I get 150x200 for a similar picture.

Attachments

const openCropper = useCallback((imagePath: string) => {
        ImagePicker.openCropper({
            path: Platform.OS === 'ios' ? imagePath : `file://${imagePath}`,
            mediaType: 'photo',
            cropping: true,
            includeExif: false,
            writeTempFile: false,
            showCropFrame: true,
            cropperChooseColor: PRIMARY_COLOR,
            cropperActiveWidgetColor: PRIMARY_COLOR,
            cropperStatusBarColor: PRIMARY_COLOR,
            cropperToolbarColor: PRIMARY_COLOR,
            cropperToolbarWidgetColor: LIGHT_COLOR,
            cropperToolbarTitle: t('cropperToolbarTitle'),
            freeStyleCropEnabled: true,
            enableRotationGesture: true,
            compressImageQuality: 0.7
        }).then(image => {
            // BUG this image resolution is never correct on iOS
            navigation.navigate('MediaPage', {
                imagePath: Platform.OS === 'android' ? image.path : `file://${image.path}`,
            });
        })
            .catch(() => {
                console.warn('user cancelled cropping')
                setIsLoading(false);
            });
    }, [navigation]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant