Comments (7)
I just proposed a fix for this issue, by moralizing the image before cropping the issue is gone. #25
from flutter_native_image.
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.
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.
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.
Indeed, when I test with a static image that definitely isn't EXIF rotated, your code (and mine) works fine.
from flutter_native_image.
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.
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)
- Method compress must be called from the worker thread, currently inferred thread is UI thread
- Error Width / Height in Portrait mode
- Package Maintenance
- Deprecated FlutterNativeImagePlugin class in new version of flutter SDK (3.7.6)
- Compress Image to targeted size in kb or mb
- Cannot even use it
- Android build warning
- Exif information not preserving. HOT 1
- is there native blur hash ?
- allow loading of image by bytes HOT 2
- flutter version need Higher HOT 1
- How to use this plugin with image from Assets HOT 2
- .png file has blackbackground after crop HOT 4
- Crop image on Ios doesn't work HOT 2
- java.lang.outofmemoryerror android HOT 1
- Miui Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference HOT 2
- Unhandled Exception: PlatformException(create_error, Temporary file could not be created, null, null)
- bounds are outside of the dimensions of the source image HOT 1
- Add feature for adding filters in image files
- Web support HOT 1
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 flutter_native_image.