在具有 >2048 像素长尺寸的图像上 Fresco automatically applies a resizing :
Android cannot display images more than 2048 pixels long in either dimension. This is beyond the capability of the OpenGL rendering system. Fresco will resize your image if it exceeds this limit.
我知道这是作为 OpenGL Android limit 的变通方法完成的,但是有什么办法可以控制吗?
以下是 Fresco 如何使用默认设置渲染 750x2440 图像的示例:
我已经尝试使用 Fresco 的调整大小/缩减采样但没有成功。
最佳答案
我可以仅使用 isResizeAndRotateEnabledForNetwork() 来实现这一目标来自 ImagePipelineConfig类,我不需要调整下采样。</p>
需要在初始化 Fresco 时增加一个额外的步骤(在 Application 类中);通过 configuring图像管道。
这是 MyApplication 类的样子:
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
ImagePipelineConfig pipelineConfig = ImagePipelineConfig.newBuilder(this)
.setResizeAndRotateEnabledForNetwork(false)
.build();
Fresco.initialize(this, pipelineConfig);
}
}
所以,不是用 Fresco.initialize(this)
来初始化 Fresco ,添加一个 ImagePipeline 类,将其配置为禁用使用 .setResizeAndRotateEnabledForNetwork(false)
调整来自网络的图像的大小,然后将配置的管道类传递给 Fresco。
设置为false时:
然后当它设置为 true 时(很可能是默认值):
关于android - 能否禁用/调整 Fresco 对大图像(>2048 像素)的自动调整大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53769797/