Git Product home page Git Product logo

Comments (8)

LuckyJayce avatar LuckyJayce commented on July 20, 2024

你的图片多大

from largeimage.

ybADMIN avatar ybADMIN commented on July 20, 2024

这个问题已经解决了,原因是因为原图编码有些问题,重新编码就能解决,不过出现另一个问题
Bitmap too large to be uploaded into a texture (440x4431, max=4096x4096)

from largeimage.

ybADMIN avatar ybADMIN commented on July 20, 2024

http://short.im.rockhippo.cn/uploads/msg/201703/20170309/1485/1489068660846.jpg

from largeimage.

ybADMIN avatar ybADMIN commented on July 20, 2024
            //加载完整图片的缩略图
            try {
                int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
                int screenHeight = context.getResources().getDisplayMetrics().heightPixels;
                int s = (int) Math.sqrt(1.0f * imageWidth * imageHeight / (screenWidth / 2) / (screenHeight / 2));
                cacheImageScale = getNearScale(s);
                if (cacheImageScale < s) {
                    cacheImageScale *= 2;
                }
                loadData.handler.sendMessage(loadData.handler.obtainMessage(MESSAGE_PIC, cacheImageScale));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

应该是这块代码中 getNearScale(s)计算有问题 图片计算后s值为1  getNearScale(s);得到的值也是1
因此会抛出
Bitmap too large to be uploaded into a texture (440x4431, max=4096x4096)
建议向上取整:
  (int) Math.sqrt(1.0f * imageWidth * imageHeight / (screenWidth / 2) / (screenHeight / 2));
改为
  int s = (int) Math.sqrt(Math.ceil(1.0f * imageWidth * imageHeight / (screenWidth / 2) / (screenHeight / 2)));

from largeimage.

LuckyJayce avatar LuckyJayce commented on July 20, 2024

那你解码后的图片是
http://short.im.rockhippo.cn/uploads/msg/201703/20170309/1485/1489068660846.jpg这个么?
还是解码前的
问题应该不在getNearScale(s),因为s为1,说明图片要显示的不缩放的

from largeimage.

LuckyJayce avatar LuckyJayce commented on July 20, 2024

调试了下本来缩放scale 1.9392987 结果(int)后变1,确定是你说的那个原因

from largeimage.

ybADMIN avatar ybADMIN commented on July 20, 2024

scale 1.9392987 结果(int)后变1
如果是不缩放的话就会
Bitmap too large to be uploaded into a texture (440x4431, max=4096x4096)
你没有遇到这个问题?

from largeimage.

LuckyJayce avatar LuckyJayce commented on July 20, 2024

已处理

from largeimage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.