我正在创建相机应用。我可以拍摄一张图像,并将该图像传递回视图控制器以显示该图像。它还保存到相机胶卷中。 如果我将带有相机预览的图像与保存的图像进行比较,则似乎相机预览有点放大了。
这是我到目前为止与相机预览无关的代码:
getCityList() {
const { StoreInfo } = this.props;
this.emptyCityList();
return StoreInfo.map((StoreInfo, index) => {
if (this.cityPushCheck(StoreInfo.city)) {
CITY_LIST.push({
id: index, label: StoreInfo.city, value: StoreInfo.city, disabled: false
});
}
});
}
cityPushCheck(cityLabel) {
const cityFromList = CITY_LIST.find(city => city.label === cityLabel);
return cityFromList === undefined;
}
如何使相机预览的尺寸与保存的图像相同?
答案 0 :(得分:0)
罪魁祸首是videoGravity
设置。 .resizeAspectFill
将调整预览的大小以填满整个视图,即使那意味着裁剪内容。
如果要查看整个框架,请将其设置为.resizeAspect
。不过,这会引入黑条。