Comments (12)
In the iOS lib, the cropped picture is being saved as a PNG instead of a JPEG. I have created a pull request for this. It may possibly solve this issue. #44
from react-native-image-editor.
Any updates on the topic ?
I'm facing the same issue on Android, althought it probably not related to this library. I use react-native-image-resizer as an input for cropping. I didn't really manage to find the exact patern that trigger the issue, but it seems to be more likely to happen when the image that you try to crop is small (like 100px X 100px ). So I suspect this is related to native-image-resizer not always handling well the resize process. I'm not sure my comments helps a lot, but well, some people might have the same problem.
And indeed commenting the line in JAVA module where the copyExif is done solve the problem.
UPDATE: it solves to issue but brings a new one... Now, sometimes, output pictures are rotated. I don't know that much about exif, but eventually, it seems to be kind of usefull ... I ended up doing a try & catch in the JAVA lines related to copyExif. At least it deals with the 10% of errors I had without side effects on pictures that were doing fine.
from react-native-image-editor.
const options = {quality: 0.5, base64: true, fixOrientation: true};
const data = await this.camera.takePictureAsync(options);
fixOrientation: true solved my problem in rotating image.
from react-native-image-editor.
Sorry my investigation was not enough.
Catch and show the code then it says ExifInterface only supports saving attributes on JPEG formats
.
try {
const data = await this.camera.takePictureAsync(options)
const hoge = await ImageEditor.cropImage(data.uri, {
offset: { x: 10, y: 10 },
size: { width: 10, height: 10 },
})
console.log(hoge)
} catch (e) {
console.error(e)
}
from react-native-image-editor.
@acro5piano What is data
returned by takePictureAsync
function?
from react-native-image-editor.
Thanks for your reply.
I'm reinstalling it, so wait a moment please.
from react-native-image-editor.
data
is something like this
{ uri: 'file:///data/user/0/com.mydomain.app/cache/Camera/29488e04-034f-4613-9108-29b42e6206d6.jpg',
height: 960,
width: 1280,
pictureOrientation: 1,
deviceOrientation: 1 }
I also tried data.base64
but no luck:
const data = await this.camera.takePictureAsync({ quality: 0.3, base64: true })
try {
const cropped = await ImageEditor.cropImage(`data:image/jpeg;base64,${data.base64}`, {
offset: { x: 10, y: 10 },
size: { width: 10, height: 10 },
})
from react-native-image-editor.
If I commented out the following line, it seems to work correctly.
Is it okay to create a PR to disable copyExif
when given params is set to do so.
I know that is not the ideal solution but should be the current workaround.
from react-native-image-editor.
@acro5piano Can you use your workaround for now? I need to dig deeper to apply the correct fix.
from react-native-image-editor.
Thank you. I will use patch-package for now.
from react-native-image-editor.
Are there any news on this? We're getting the error as well but only on few devices. Can't reproduce this yet but we're using react-native-image-resizer as input for cropping as well. An issue were created there for an related topic too but this was already merged in January and we're running the newest version (just updated from 1.2.3 to 1.2.4 now).
Here the related PR: bamlab/react-native-image-resizer#209
Data looks fine... this is from our logs:
Error while cropping image: ExifInterface only supports saving attributes on JPEG formats.
uri: file:///data/user/0/XXX/cache/Camera/5deb3737-0c94-4925-bb7f-695a83215ef2.jpg, width: 252, height: 320
resImageUri: file:///data/user/0/XXX/cache/1599207653198.JPEG, width: 180, height: 320
2nd line (uri: ...) contains the data input for react-native-image-resizer and 3rd line the resized image data returned by react-native-image-resizer.
Is the only solution currently to modify the code itself as mentioned by @acro5piano and additionally add the fix for orientation as pointed out by @MebDevelop or is there already a new configuartion option or anything else I may have missed?
from react-native-image-editor.
react-native-camera
is deprecated. Please use react-native-vision-camera
instead
from react-native-image-editor.
Related Issues (20)
- Please publish the latest build from Github, onto npm! HOT 2
- iOS compilation failures after Expo SDK 44/RN 0.64.3 upgrade HOT 3
- Why i can't install this library? HOT 6
- I am trying to use Image editor library of react native but whenever I install this library I am unable to make my build to start my app locally can you help me ?? HOT 2
- Inconsistent handling of EXIF between Android and iOS HOT 5
- run-ios fail HOT 9
- Not compatible with react 18 HOT 4
- Is this discontinued? HOT 1
- remove jcenter for android build.gradle HOT 1
- call to undeclared function 'RCTTransformFromTargetRect'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] CGAffineTransform transform = RCTTransformFromTargetRect(image.size, targetRect); HOT 1
- [4.x] Release plan HOT 1
- Prompt error that ' Error: Requiring module "src/component/index.tsx", which threw an exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNCImageEditor' could not be found. Verify that a module by this name is registered in the native binary' in IOS
- getting error in some android devices when cropping the images HOT 4
- Prompt error that ' Error: Requiring module "src/component/index.tsx", which threw an exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNCImageEditor' could not be found. Verify that a module by this name is registered in the native binary'only happen in IOS HOT 4
- Incorrect scaling on Android HOT 6
- Offset not correct in some Android devices HOT 10
- Library support for New Architecture + Bridgeless HOT 2
- Prompt error that ' Error: Requiring module "src/component/index.tsx", which threw an exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNCImageEditor' could not be found. Verify that a module by this name is registered in the native binary'only happen in IOS HOT 3
- not working with react-native-image-crop-picker, pickedImage.path or pickedImage.sourceURL
- install error usning npm@7 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-image-editor.