Comments (4)
I was having issues with this as well. What worked for me was setting the x and y option instead of using the defaults and make sure that neither the width or height the same as the original (subtract 1 if it's the same). You also need to count for the pixel density of the images in the crop dimensions which you can get with Ti.Platform.displayCaps.logicalDensityFactor. What worked for me (was changing image ratio from 4:3 to 16:9):
image = ImageFactory.imageAsCropped(image, {
x: 0,
y: 0,
width: ((image.height*density)/1.777778)-1,
height: (image.height*density)-1
});
from ti.imagefactory.
Hi @a-axton,
Thanks for the above explanation & example code!
I'm still having an issue getting the imageAsCropped method to output my desired result. Since you've been able to figure out how to return what you needed from the module, I figured I'd reach out & ask for a little help.
My current result outputs a similar result to @NagarjunaReddy's, being zoomed, off center, blurred and/or stretched/compacted...
Here's what I'm looking to do:
- Take a photo with the camera (fullscreen portrait device height & device width)
- Crop the returned photo (e.media) to be square (width = device width & height = device width)
- Populate ImageView with cropped photo from the actions above
Here's an image to give you a visual:
Let me know if you need more info & any help is much appreciated!
ยท Jason
from ti.imagefactory.
@designbymind Is this resolved by now? I would suggest to use the center points and crop it from there using the specified width and height. That worked for me in the past. Thx!
from ti.imagefactory.
Hey @hansemannn - it's been awhile since I tried using the imageFactory cropping method as I'd found an alternative solution at the time. I even tried using the method you recommended above with no success. However, since having an additional (commonJS) module for cropping is unnecessary overhead if the built-in cropping methods of imageFactory work as expected, I'd be happy to test that out. I'm currently working with the camera for a new app & as soon as I get to that part of the development stage, I'll report back with my findings. Thanks man!
from ti.imagefactory.
Related Issues (17)
- iOS 64-bit distribution build? HOT 1
- 64 bit support? HOT 3
- Error with remote image HOT 3
- Very unstable on Android HOT 3
- cant find module: ti.imagefactory for architecture x86_64 HOT 4
- Android: java.lang.NullPointerException HOT 1
- Can't run on Android 6.0 HOT 14
- Dist for ios HOT 2
- Android: PX dimension support for Android HOT 2
- After compress the image clarity and quality missed? HOT 1
- SDK6.0? HOT 1
- Module not listed HOT 1
- Feature request: async resizing / compression
- iOS .imageAsResized() on image/jpeg generates a blob with mimeType image/png
- Android: (Rare) ANR when using ImageFactory.compress() HOT 6
- User Reports via Q&A that on ios, images blob is resized, but saved file is not HOT 2
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 ti.imagefactory.