android - Aviary 返回的图像尺寸小于原始尺寸

标签 android image-processing aviary

我在我的 android 应用程序中使用 Aviary 编辑图像,但我发现返回的图像比原始图像小。

例如,我将一张 2560x1920 的大图片传递给 aviary,但返回的图片是 480x640。

这是我的代码:

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

我错过了什么吗?

最佳答案

终于找到解决办法了。它在 Aviary android 示例应用程序中提到

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

关于android - Aviary 返回的图像尺寸小于原始尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13476231/

相关文章:

android - 使用 IndoorAtlas 确定当前位置是在建筑物内部还是外部

android - 无法暂停 Activity ,尚未创建内容 View

matlab - MATLAB 函数 imread 和 imwrite 是否属于图像处理工具包?

algorithm - 将一组线段近似为一条最佳拟合直线

android - 鸟舍 Activity 崩溃

javascript - 多重鸟舍羽毛

java - Webview 在 Ice Cream Sandwich 中显示白色空白页面

java - OSMDroid Bonus Pack - gradle.build 错误 - 无法解决依赖关系

python - TensorFlow:如何将图像解码器节点添加到我的图中?