4.14-1 图片太大遇到的问题,Bitmap too large to be uploaded into a texture (2340x4160, max=4096x4096)
来源:互联网 发布:橱柜设计软件下载 编辑:程序博客网 时间:2024/05/21 09:11
02-16 22:28:32.618 19893-19935/com.example.kodulf.devicepicture
W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (2340x4160, max=4096x4096)
解决方法:
BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 32; Bitmap bitmap = BitmapFactory.decodeFile(file.getPath(),options); imageView.setImageBitmap(bitmap);参考知识点:
对于大图片而言,显示在手机程序上,图片细节已经没有意义了,如果我们可以加载成缩略图的概念就好了。。。。。如果直接能够从图片文件加载一个缩略之后的图片到内存里,那么就可以减少这个尺寸了。理解为加载的就是缩略图,使用BitmapFactoryblic void btnLoadPic(View view) { //大图片 // imageView.setImageResource(R.mipmap.large_pic); //从大图片,在加载的时候,直接加载缩小尺寸的缩略图,(BitmapFactory) Resources res = getResources(); //图片加载时,可以指定,Options参数,实际上BitmapFactory 通过Options // 可以将配置的参数传递给图片解码器() BitmapFactory.Options options = new BitmapFactory.Options(); //图片解码的时候进行的采样比例,1代表不变,原始尺寸 // ,2 以及一闪给,代表宽度/inSampleSize 高度/inSampleSize options.inSampleSize = 32; Bitmap bitmap = BitmapFactory.decodeResource(res, R.mipmap.large_pic,options); imageView.setImageBitmap(bitmap); // }Options 代表图片在解析的时候,BitmapFactory内部应该如何处理图片内容。Options.inSampleSize() 图片采样率,代表图片宽度以及高度按照指定的数值进行缩小,例如=4代表宽度上4个相熟,采样为1个相熟,高度同样进行处理,最终图片面积以及向叔叔变为原始图片的1/16图片,mp3,都需要解码---------------------------------------------------------------------------------------------------标准的图片内存采样规则:1:先获取图片原始的尺寸,更具尺寸进行采样率的计算,根据尺寸进行采样率的计算,利用原始尺寸与在程序界面上的显示尺寸进行计算。2:当计算完成后,再一次进行图片的解码。并且指定采样率,直接加载降低的版本。3:图片的二次采样。inSampleSize的计算:1:例如用2的倍数,来进行计算(图片解码采样2的幂,采样效率是最快的);2:原始尺寸与目标尺寸,宽高都要进行比较。3:其实就是缩小到涵盖目标尺寸的最小的采样值。
0 0
- 4.14-1 图片太大遇到的问题,Bitmap too large to be uploaded into a texture (2340x4160, max=4096x4096)
- Bitmap too large to be uploaded into a texture (1080x4467, max=4096x4096)
- Bitmap too large to be uploaded into a texture (2880x5120, max=4096x4096)
- Bitmap too large to be uploaded into a texture (1284x5582, max=4096x4096)
- BitmapFactory解码图片不显示(Bitmap too large to be uploaded into a texture (3120x4208, max=4096x4096)
- W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (1080x4196, max=4096x4096)
- Android加载SD卡图片出现too large to be uploaded into a texture (4128x2322, max=4096x4096)的解决办法
- android加载长图片出现Bitmap too large to be uploaded into a texture的解决方案
- Bitmap too large to be uploaded into a texture问题的解决方法
- Bitmap too large to be uploaded into a texture
- Bitmap too large to be uploaded into a texture 解决方法
- Bitmap too large to be uploaded into a texture exception
- Bitmap too large to be uploaded into a texture
- Bitmap too large to be uploaded into a texture
- Bitmap too large to be uploaded into a texture
- Bitmap too large to be uploaded into a texture
- Bitmap too large to be uploaded into a texture 解决方案
- Bitmap too large to be uploaded into a texture 解决方法
- KMP模板
- Windows10强力卸载OneDrive
- 【每周一文】Factorization Machines
- videoView
- 删除Xcode中多余的证书provisioning profile
- 4.14-1 图片太大遇到的问题,Bitmap too large to be uploaded into a texture (2340x4160, max=4096x4096)
- App Store审核被拒的各种原因
- UVA 101
- BZOJ(本校) 3027 快速傅里叶变换 - 概率与期望&dp
- Python基本数据类型
- Building Maintainable Software-java篇之 Write Clean Code
- CA服务器的创建和CA客户端认证过程
- linux-信号量
- leetcode279-Perfect Squares