0

I try to set a large bitmap(720*18463) to ImageSpan, but it didn't appear, and the problem is :

W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (720x18463, max=4096x4096)

How to deal with it ?

(Addtional, I want to make a RichText Editor, which can add image around text.)

Hamed Javaheri
  • 538
  • 3
  • 13
2BAB
  • 1,215
  • 10
  • 18
  • use createScaledBitmap to decrease size of your bitmap – kaitian521 Jul 26 '16 at 04:18
  • @kaitian521 But I actually need every pixel, and I know ImageView Widget may do it without decreasing.Is there any way to load it in ImageSpan? – 2BAB Jul 26 '16 at 05:00

2 Answers2

1

Scale your Bitmap when decode, and wrap it with a BitmapDrawable if you want to control the bounds.

linroid
  • 66
  • 3
0

There is no sense to put 18463 pixels bitmap on a screen, because it's large then any screen existed on market. You must to scale it down in order to make it works. In order to scale it down, please check that answer.

Community
  • 1
  • 1
Divers
  • 9,531
  • 7
  • 45
  • 88
  • I wonder if there is a way to scale it down (maybe 72*1846) but also render it in full-width (like 720p/1080p). I know **scaleType** of the ImageView is an example, and what about ImageSpan? – 2BAB Jul 26 '16 at 06:07
  • Get width of screen and scale down it to that size. – Divers Jul 26 '16 at 06:09
  • The Width of Image is now 720 and almost fit the screen width of Nexus 4 which is my test device. – 2BAB Jul 26 '16 at 06:23
  • @2BAB why you accepted another answer if it's the same as mine, but was given half hour latter? – Divers Jul 26 '16 at 07:44
  • I got the point of decreasing from you (thanks for this), but not Drawable$setBounds that solve my problem. – 2BAB Jul 27 '16 at 07:03