7

I'm using Aviary to edit image in my android application, but I found the returning image is smaller than original.

For example, I past an big image 2560x1920 to aviary, but the returning image is 480x640.

This is my code:

private void startFeather(Intent data) {
    File file = getBitmapFromResult(data);

    BitmapInfo bitmap = Helper.getBitmap(file, App.screenWidth, 0);
    toastLong("raw photo: " + bitmap.getWidth() + "x" + bitmap.getHeight());

    Uri uri = Uri.fromFile(file);

    this.featherOutputFile = new File(App.Path.tempDir(), "111" + ".jpg");

    // Create the intent needed to start feather
    Intent newIntent = new Intent(self, FeatherActivity.class);

    // set the source image uri
    newIntent.setData(uri);

    // pass the required api key ( http://developers.aviary.com/ )
    String API_KEY = "aaabbbccc";

    newIntent.putExtra("API_KEY", API_KEY);

    // pass the uri of the destination image file (optional)
    // This will be the same uri you will receive in the onActivityResult
    newIntent.putExtra("output", Uri.parse("file://" + featherOutputFile.getAbsolutePath()));

    // format of the destination image (optional)
    newIntent.putExtra("output-format", Bitmap.CompressFormat.JPEG.name());

    // output format quality (optional)
    newIntent.putExtra("output-quality", 100);

    // you can force feather to display only a certain tools
    // newIntent.putExtra( "tools-list", new String[]{"ADJUST", "BRIGHTNESS" } );

    // enable fast rendering preview
    newIntent.putExtra("effect-enable-fast-preview", true);

    // limit the image size
    // You can pass the current display size as max image size because after
    // the execution of Aviary you can save the HI-RES image so you don't need a big
    // image for the preview
    newIntent.putExtra("max-image-size", App.screenWidth);
    newIntent.putExtra("effect-enable-external-pack", false);
    newIntent.putExtra("stickers-enable-external-pack", false);
    newIntent.putExtra("effect-enable-borders", false);

    // HI-RES
    // You need to generate a new session id key to pass to Aviary feather
    // this is the key used to operate with the hi-res image ( and must be unique for every new instance of Feather )
    // The session-id key must be 64 char length
    String mSessionId = StringUtils.getSha256(System.currentTimeMillis() + API_KEY);
    newIntent.putExtra("output-hires-session-id", mSessionId);

    // you want to hide the exit alert dialog shown when back is pressed
    // without saving image first
    // newIntent.putExtra( "hide-exit-unsave-confirmation", true );

    // ..and start feather
    startActivityForResult(newIntent, INTENT_FEATHER);
}

Do I miss anything?

3
  • Did you use the hi-res-output? Otherweise only the smaller preview is returned whose size depends on the memory of the device. Jul 2, 2013 at 12:53
  • Can I help you? But you need to use other lib. Jan 12, 2014 at 10:10
  • @Freewind Sorry for this as I am asking because this question did not get any answer even after two years.. Did you get any solution.. I am facing the same issue now
    – Praveena
    Nov 8, 2014 at 12:40

1 Answer 1

1

Finally Got the solution. It is mentioned in Aviary android sample app

final DisplayMetrics metrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics( metrics );
        int max_size = Math.max( metrics.widthPixels, metrics.heightPixels );
        max_size = (int) ( (float) max_size / 1.2f );
        newIntent.putExtra( Constants.EXTRA_MAX_IMAGE_SIZE, max_size );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.