Giter VIP home page Giter VIP logo

imageasresized's Issues

Can not resize using "cameraImageAsResized"

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

RuntimeException: Canvas: trying to use a recycled bitmap

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?

FileNotFoundException

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?

floating point scale and crop bug

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

~~

Install failed

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

License issue when using the module

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

Image is not resized to the specified dimensions

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:

tia-465971611

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

Cant add module

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

License violation detected. Unlicensed module(s) detected

[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..

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.