callstack / callstack/react-native-image-editor

Crop result wrong on iOS 16.3

未关闭
#163 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Kotlin
星标
448
派生
119
平均合并
1 天 11 小时
30 天内合并 PR
4

描述

## Environment

Phisical Device: iPhone 13 Pro Max
OS: iOS 16.2.7

Project:
"react-native": "0.74.3",
"@react-native-community/image-editor": "^4.2.0",
"expo": "~51.0.23",
"react-native-vision-camera": "^4.5.1",

## Description

**The crop result is outside what was expected**

*This code works perfectly in all other devices/emulators and OS versions, for both Android, iOS.

This bug only happen when I got a picture from react native vision camera, when picked with expo-image-picker, it works fine!

The green toast in end of the video is:
Original Image Height and Image Width

Image crop area Height and Width
Position X and Y above the Image crop area

https://github.com/user-attachments/assets/ab1b5711-82ed-4dcc-88b7-6cec8b45e4f8

## Reproducible Demo

```javascript
const handlePress = async () => {
try {
setTranscriptionLoading(true);
const widthRatio = image.width / imageLayout.width;
const heightRatio = image.height / imageLayout.height;

const cropData: ImageCropData = {
offset: { x: cropX.value * widthRatio, y: cropY.value * heightRatio },
size: { width: cropWidth.value * widthRatio, height: cropHeight.value * heightRatio },
resizeMode: "cover",
format: "webp",
quality: Platform.OS === "ios" ? 0.5 : 0.9,
includeBase64: false,
};

const croppedImageUri: CropResult = await ImageEditor.cropImage(image.uri, cropData);

handleTranscription(croppedImageUri);
} catch (error) {
console.error("Crop Error", error);
Toast.show({ type: "error", text1: "Erro ao processar imagem" });
}
};
```

贡献指南

打开贡献指南

调研方向

从 handlePress 入口点及其对 ImageEditor.cropImage 的调用开始,然后在所列出的 iOS 环境中,将 react-native-vision-camera 生成的图像 URI 与 expo-image-picker 生成的图像 URI 进行比较。使用提供的比例和裁剪数据重现裁剪;完成标准是结果在 iOS 上与选定区域匹配,同时不导致其他平台出现回归。

由索引模型根据 Issue 内容生成。

评估

技术栈
ios, javascript, react-native
领域
mobile
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。