Git Product home page Git Product logo

Comments (12)

takameyer avatar takameyer commented on July 4, 2024 1

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.

johanschram avatar johanschram commented on July 4, 2024 1

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.

lee-corey avatar lee-corey commented on July 4, 2024 1

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.

acro5piano avatar acro5piano commented on July 4, 2024

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)
    }

image

from react-native-image-editor.

Trancever avatar Trancever commented on July 4, 2024

@acro5piano What is data returned by takePictureAsync function?

from react-native-image-editor.

acro5piano avatar acro5piano commented on July 4, 2024

Thanks for your reply.
I'm reinstalling it, so wait a moment please.

from react-native-image-editor.

acro5piano avatar acro5piano commented on July 4, 2024

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 },
  })

image

from react-native-image-editor.

acro5piano avatar acro5piano commented on July 4, 2024

If I commented out the following line, it seems to work correctly.

https://github.com/react-native-community/react-native-image-editor/blob/master/android/src/main/java/com/reactnativecommunity/imageeditor/ImageEditorModule.java#L282

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.

Trancever avatar Trancever commented on July 4, 2024

@acro5piano Can you use your workaround for now? I need to dig deeper to apply the correct fix.

from react-native-image-editor.

acro5piano avatar acro5piano commented on July 4, 2024

Thank you. I will use patch-package for now.

from react-native-image-editor.

mppperez avatar mppperez commented on July 4, 2024

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.

retyui avatar retyui commented on July 4, 2024

react-native-camera is deprecated. Please use react-native-vision-camera instead

from react-native-image-editor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.