在Android的裁剪图像大小不变 [英] Cropped Image size in Android is constant

查看:142
本文介绍了在Android的裁剪图像大小不变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我种植的循环方式的图像,并使用跌破code,而创造的意图

I am cropping an image in circular fashion and using below code while creating the intent

    intent.setData(mImageCaptureUri);
    intent.putExtra("outputX", 200);
    intent.putExtra("outputY", 200);
    intent.putExtra("aspectX", 1);
    intent.putExtra("aspectY", 1);

由于我使用的outputX = 200,我得到宽度每裁剪图像和高度为200和200,不管我有多放大或缩小。

Since I am using outputX = 200, I am getting width and height of every cropped image as 200 and 200 , no matter how much I zoom-in or zoom out.

下面示出两个图像具有不同的变焦比,但是仍然会返回相同的高度和宽度。

Below shown both images have different zoom ratio but still return same height and width.

 width  = bitmap.getWidth(); 

有人能告诉我,我应该在网上使用的参数

Can someone please tell me what parameter should I use in line

intent.putExtra("outputX", 200);

,这样我得到裁剪图像的真宽度和高度(未在每种情况下,200)。

so that I get the TRUE width and height(not the 200 in each case) of cropped image.

推荐答案

不知道这是问题,当我回答了你的<一个href="http://stackoverflow.com/questions/19204619/need-circular-cropping-functionality-instead-of-rectangular/19640905">earlier题。我相信你正在寻找的应该是答案:

Didn't know this was the issue when I answered the your earlier question. I believe the answer you are looking for should be:

intent.setData(mImageCaptureUri);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("scale", false);

请确保您设置的参数规模为false。它默认为true。

Make sure you set the parameter scale to false. It defaults to true.

PS由于Android是开源的,相机+作物应用程序是操作系统的一部分,所有我做的是阅读源。你应该看的文件是<一个href="http://grep$c$c.com/file/repository.grep$c$c.com/java/ext/com.google.android/android-apps/4.1.2_r1/com/android/camera/CropImage.java"相对=nofollow>此处。退房变量mScale怎么看参数被使用。

PS Since Android is open source and the camera + crop app is a part of the OS, all I am doing is reading the source. The file you should be looking at is here. Check out variable mScale to see how the parameter is being used.

这篇关于在Android的裁剪图像大小不变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆