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

I can't recognise QR on some images on ios #12

Open
ivan133 opened this issue Feb 18, 2019 · 1 comment
Open

I can't recognise QR on some images on ios #12

ivan133 opened this issue Feb 18, 2019 · 1 comment

Comments

@ivan133
Copy link

ivan133 commented Feb 18, 2019

I'm using your package to recognise qr from image.
But mostly it returns error "Feature size is zero!"
Althoght the image is pretty good quality.
Also it works perfectly on android with the same image.

I'm using react-native-image-picker to get image.
But looks like it return full size images.

  _selectImage = () => {
    const options = {
      storageOptions: {
        skipBackup: true,
        path: 'images'
      }
    };

    ImagePicker.launchImageLibrary(options, (response) => {
      if (response.didCancel) {
        // console.log('User cancelled image picker');
      } else {
        this.setState({
          imagePath: response.uri,
          imageRotation: response.originalRotation || 0
        });
        console.log('response', response)
        QRCodeReader.decode(Platform.OS === 'ios' ? response.uri.replace('file://', '') : response.path || response.uri, (error, result)=>{
          console.log('error', error);
          console.log('result', result);
          if (error){
            if (error.message === 'Feature size is zero!'){
              Alert.alert(I18n.t('generic.error'), I18n.t('qr_content.qr_code_not_found'));

            } else {
              Alert.alert(I18n.t('generic.error'), I18n.t('qr_content.qr_code_not_found' + ' ' + error.message));
            }
          } else {
            if (result){
              Alert.alert('result', result);
            } else {
              Alert.alert(I18n.t('generic.error'), I18n.t('qr_content.cant_decode_kf_qr'));
            }
          }
        });
      }
    });
  };
@ivan133
Copy link
Author

ivan133 commented Feb 18, 2019

The QR on the image is rotated to 45 deg but it should not be a problem, right?

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