HarmonyOS 鸿蒙Next全屏预览时没有合适的 photoProfiles 和 previewProfiles 尺寸可选

发布于 1周前 作者 phonegap100 来自 鸿蒙OS

HarmonyOS 鸿蒙Next全屏预览时没有合适的 photoProfiles 和 previewProfiles 尺寸可选

竖屏状态下,我手机的 宽/高为:1260/2720,因为 profiles 的宽高是相反的,可以选择合适的预览值 横屏状态下,我手机的 宽/高为:2720/1260,所有的 profiles 中几乎都是高大于宽,所以我没有合适的 profiles 可以选择。  补充: 我测试了系统相机, 在竖屏全屏的情况下,输出的图片为:1888x4096,这个可以和 photoProfiles 其中的一个对应 在横屏全屏的情况下,输出的图片为:2336x1080,这个没有相应的 photoProfiles 与之对应,请问这个是怎么做到可以输出宽大于高的图片的呢?  previewProfiles 所有的 size 如下 [{"format":1003,"size":{"width":640,"height":480}},{"format":1003,"size":{"width":640,"height":640}},{"format":1003,"size":{"width":864,"height":480}},{"format":1003,"size":{"width":1088,"height":1080}},{"format":1003,"size":{"width":1088,"height":1088}},{"format":1003,"size":{"width":1136,"height":480}},{"format":1003,"size":{"width":1280,"height":592}},{"format":1003,"size":{"width":1280,"height":720}},{"format":1003,"size":{"width":1280,"height":960}},{"format":1003,"size":{"width":1440,"height":1080}},{"format":1003,"size":{"width":1920,"height":1080}},{"format":1003,"size":{"width":1920,"height":1440}},{"format":1003,"size":{"width":2048,"height":1536}},{"format":1003,"size":{"width":2336,"height":1080}},{"format":1003,"size":{"width":2560,"height":1080}},{"format":1003,"size":{"width":2592,"height":1944}}]  photoProfiles 所有的 size 如下 [{"format":2000,"size":{"width":640,"height":480}},{"format":2000,"size":{"width":640,"height":640}},{"format":2000,"size":{"width":864,"height":480}},{"format":2000,"size":{"width":1088,"height":1088}},{"format":2000,"size":{"width":1136,"height":480}},{"format":2000,"size":{"width":1280,"height":592}},{"format":2000,"size":{"width":1280,"height":720}},{"format":2000,"size":{"width":1280,"height":960}},{"format":2000,"size":{"width":1440,"height":1080}},{"format":2000,"size":{"width":1920,"height":1080}},{"format":2000,"size":{"width":1920,"height":1440}},{"format":2000,"size":{"width":2048,"height":1536}},{"format":2000,"size":{"width":2336,"height":1080}},{"format":2000,"size":{"width":2560,"height":1080}},{"format":2000,"size":{"width":2592,"height":1944}},{"format":2000,"size":{"width":3072,"height":3072}},{"format":2000,"size":{"width":3120,"height":3120}},{"format":2000,"size":{"width":3264,"height":2448}},{"format":2000,"size":{"width":3840,"height":2160}},{"format":2000,"size":{"width":4096,"height":1760}},{"format":2000,"size":{"width":4096,"height":1888}},{"format":2000,"size":{"width":4096,"height":2304}},{"format":2000,"size":{"width":4096,"height":3072}},{"format":2000,"size":{"width":8192,"height":6144}}] 问题:全屏预览时没有合适的 photoProfiles 和 previewProfiles尺寸可选


更多关于HarmonyOS 鸿蒙Next全屏预览时没有合适的 photoProfiles 和 previewProfiles 尺寸可选的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html

1 回复

更多关于HarmonyOS 鸿蒙Next全屏预览时没有合适的 photoProfiles 和 previewProfiles 尺寸可选的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


针对HarmonyOS 鸿蒙Next全屏预览时没有合适的photoProfiles和previewProfiles尺寸可选的问题,这通常是由于设备的屏幕分辨率与相机预览或拍照的默认配置不匹配所导致的。以下是一些可能的解决方案:

  1. 获取设备支持的分辨率:首先,需要获取设备支持的所有相机预览和拍照分辨率。这可以通过编程接口(API)实现,比如查询camera.Profile中的预览和拍照配置。
  2. 计算最佳匹配:根据设备的屏幕分辨率,计算出一个最接近且不会造成画面变形的预览和拍照分辨率组合。这通常涉及到宽高比的匹配和计算。
  3. 设置分辨率:使用计算出的最佳分辨率配置相机预览和拍照功能。这通常需要在代码中指定相应的profile。

如果上述方法仍然无法解决问题,可能是由于设备的特殊性或系统的限制。此时,建议尝试更新HarmonyOS系统到最新版本,或者查看官方文档和开发者社区以获取更多帮助。如果问题依旧没法解决请联系官网客服,官网地址是:https://www.itying.com/category-93-b0.html

回到顶部