yagitoshiro / imageasresized Goto Github PK
View Code? Open in Web Editor NEWTitanium Mobile (Android)
Home Page: http://selfkleptomaniac.org/
License: Other
Titanium Mobile (Android)
Home Page: http://selfkleptomaniac.org/
License: Other
i've tried this code.
var rate = blob.width / 1024;
blob = androimage.cameraImageAsResized(blob, blob.width / rate, blob.height / rate, 0);
but this did not work as i expected, it croped the image.
the source image is 3264x2448.
this code did not work also.
blob = androimage.cameraImageAsResized(blob, 1024, blob.height * (1024 / blob.width), 0);
this code worked fine.
blob = androimage.cameraImageAsResized(blob, blob.width / 2, blob.height / 2, 0);
i want to limit the image width.
how do i fix this issue?
ImageAsResized v0.5, Titanium SDK 3.1.1.GA
I want to resize and crop a picture in Titanium 3.2, but I ran into a out of memory-error on devices where photos are too big. I was recommended to check this module out. I'm however running into some problems:
var resized_image = e.media;
var rate = 16;
var width = e.cropRect.width / rate;
var height = e.cropRect.height / rate;
resized_image = image_module.cameraImageAsResized(resized_image, width, height, 0);
savedImage = resized_image.imageAsThumbnail(400,0,0);
picture.image = savedImage;
I'm using imageAsThumbnail afterwards to make sure that I'm getting a correctly cropped and sizes image, that will later be sent to an API. However, when I'm doing this I get the following message: RuntimeException: Canvas: trying to use a recycled bitmap
Is there a way to fix this?
When I am using the module and want to resize an image, I get the following error in the Android Monitor:
06-26 14:27:34.154: D/ImageasresizedModule(18881): (KrollRuntimeThread) [97,36079] Bitmap IOException:java.io.FileNotFoundException: file:///mnt/sdcard/app_identifier/preview__tifile54854tmp.jpg
The file path I specify as a parameter is the one returned by calling Ti.Filesystem.File.nativePath. If I call the method with Ti.Filesystem.File.resolve() I get the same error.
At first I thought it might be missing permissions, but in the Android manifest the entry: is set.
I am using Titanium 3.1.0.GA. If this error is not related to the module, could you provide me any hint how I could solve this issue?
Hi,
I think I now why you code sometimes doesn't work. BitmapFactory.decodeByteArray returns smaller image if you pass inSampleSize >1. however later you still use original dimensions to crop the image. You need to recalculate x,y,w,h that you use for cropping (Bitmap.createBitmap) for the new smaller resolution. The matrix in Bitmap.createBitmap happens after the crop and can scale image further. the scale passed to the matrix can be float and works without any issues. But that scale has nothing to do with the crop dimensions you pass to the function.
thank you for your module. I was able to learn from it and write my custom one that does just one thing - centre crop and scale to desired resolution (to create square thumbnails in one operation). Without your code I wouldn't have a clue where to start.
Bitmap image_base = BitmapFactory.decodeByteArray(image_data, 0, image_data.length, opts);
Matrix matrix = getScaleMatrix(opts.outWidth, opts.outHeight, image_base.getWidth(), image_base.getHeight());
if(rotate > 0){
matrix.postRotate(rotate);
}
//width, height etc passed here are form original image not scaled down image_base.
return returnBlob(opts, image_base, matrix, width, height, x, y);
~~
I can't install it's show
BUILD FAILED
/Users/Mycom/Library/Application Support/Titanium/mobilesdk/osx/3.1.0.GA/module/android/build.xml:163: Compile failed; see the compiler error output for details
Hello,
I found a problem when trying to compile and use your module.
I had a license issue, telling that I was not allowed to use that module because I was not subscribed.
I solved the issue changing the guid in the manifest.
I presume you are using the same guid for this Open Sourced version and the compiled version in Appcelerator MarketPlace.
Regards,
Jose
Hi there,
Thanks very much for this library it has been a lifesaver!
One problem I am experiencing is that the image doesn't appear to get resized to the dimensions I specify.
For example the following original image is 3264 x 2448:
And when I resize to 450 x 338, it actually goes to 1479 x 1110.
Do you know why this would be? I am using the following method:
resizedImage = androidResizer.cameraImageAsResized(args.media, newImageWidth, newImageHeight, 0);
Thanks in advance, Carl
Looks like Android has this on the newest SDK versions as well: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Blob-method-imageAsResized
What is the correct syntax for entering the module into the tiapp.xml file? eg:
imageasresized
My error is:
[DEBUG] Detected module for android: org.selfkleptomaniac.ti.imageasresized 0.2 @ C:\Users\Deminetix\AppData\Roaming\Titanium\modules\android\org.selfkleptomaniac.ti.imageasresized\0.2
[DEBUG] Looking for Titanium Module id: imageasresized, version: 0.2, platform: android
[WARN] Couldn't find app module: imageasresized
[ERROR] TiVerify: (Timer-0) [534,5920] License violation detected. Unlicensed module(s) detected. You must be a subscriber to use one or more of the modules included with this project.. Please contact Appcelerator Support.
I need a license to use this module ?, thanks..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.