Giter Club home page Giter Club logo

Comments (7)

mazzonem avatar mazzonem commented on August 15, 2024 4

I just proposed a fix for this issue, by moralizing the image before cropping the issue is gone. #25

from flutter_native_image.

btastic avatar btastic commented on August 15, 2024

Hmm I didn't write that function and I don't have a lot of time to investigate right now. Maybe @a-leblond can chime in and see if there is anything wrong? Thanks!

from flutter_native_image.

a-leblond avatar a-leblond commented on August 15, 2024

Hi !

It seems weird, I use this function on iOS and Android in one of my project to square crop images and it works fine on both.
I don't see anything wrong with your code ... Could you try this and tell us if it works ? It's the code I use in my app :

  var imgProperties = await FlutterNativeImage.getImageProperties(widget.imagefile.path);
  var croppedImage;
  if(imgProperties.width > imgProperties.height)
    croppedImage = await FlutterNativeImage.cropImage(widget.imagefile.path,
        (imgProperties.width~/2)-(imgProperties.height~/2), 0,
        imgProperties.height, imgProperties.height);
  else
    croppedImage = await FlutterNativeImage.cropImage(widget.imagefile.path,
        0, (imgProperties.height~/2)-(imgProperties.width~/2),
        imgProperties.width, imgProperties.width);

from flutter_native_image.

dmjones avatar dmjones commented on August 15, 2024

Thanks for sharing your code. I get the same result when using your code.

At the moment, my best guess is that it's somehow related to EXIF rotation data. AIUI, if the rotation data is ignored, the image will appear sideways. I'm wondering if bits of the library code respect the EXIF data and bits don't.

I'll do some further digging with 'normal' images and will report back.

from flutter_native_image.

dmjones avatar dmjones commented on August 15, 2024

Indeed, when I test with a static image that definitely isn't EXIF rotated, your code (and mine) works fine.

from flutter_native_image.

a-leblond avatar a-leblond commented on August 15, 2024

Hmmmm I had some issues with the EXIF and image, so I use flutter_native_image in my app and it works fine both with the camera and static images, on Android and iOS.

Maybe it's the camera package you are using ? I use image_picker to take photo with the camera, you could give it a try.

I'll look deeper in the flutter_native_image code to see if there is something wrong this week.

from flutter_native_image.

dmjones avatar dmjones commented on August 15, 2024

I've started migrating to image_picker, which should avoid this problem. (I'm also moving away from square cropped images).

So I'm happy to close this, as my need has gone away. But leaving it open for now in case others are interested...

from flutter_native_image.

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.