bitmap fuzzy!

All your problems with Audio, Video and Images.

bitmap fuzzy!

Postby kris_xu » Tue Apr 28, 2009 9:54 am

hi

I want to display a png file in a view.

but i found the picture was fuzzy, I don't know what's wrong with it.

code:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private Bitmap downloadImage(String urlStr) {
  2.                 Bitmap bitmap = null;
  3.                 InputStream in = null;
  4.                 URL url = null;
  5.                 try {
  6.                         url = new URL(urlStr);
  7.                         HttpURLConnection conn = (HttpURLConnection) url.openConnection();
  8.                         in = conn.getInputStream();
  9.                         BitmapFactory.Options opts = new BitmapFactory.Options() ;
  10.                         opts.inSampleSize = 1;
  11.                         bitmap = BitmapFactory.decodeStream(in);
  12.                 } catch (IOException e1) {
  13.                         e1.printStackTrace();
  14.                 }finally{
  15.                         try {
  16.                                 if(in != null)
  17.                                         in.close();
  18.                         } catch (IOException e) {
  19.                                 e.printStackTrace();
  20.                         }
  21.                        
  22.                 }
  23.                 return bitmap;
  24.         }
  25.  
  26. adapt = downloadImage("http://www.x-navi.cn/images/map_blocks/2/6/6/6/00000069_00000069.png");
  27.  
  28. canvas.drawBitmap(adapt, 0, 0, paint);
  29.  
  30.  
Parsed in 0.033 seconds, using GeSHi 1.0.8.4




anyone help me.

thanks.

normal:
Image
Attachments
1.jpg
fuzzy.
1.jpg (6.32 KiB) Viewed 246 times
kris_xu
Freshman
Freshman
 
Posts: 5
Joined: Fri Apr 03, 2009 3:42 am

Top

Postby kris_xu » Wed May 06, 2009 8:20 am

anybody know this?
kris_xu
Freshman
Freshman
 
Posts: 5
Joined: Fri Apr 03, 2009 3:42 am

Postby padde » Wed May 06, 2009 12:10 pm

The picture seems to get resized.. your normal one is 128x128
the fuzzy one is 128x127.
Dont know where it gets resized because you provide no code or information
about the canvas itself.

Greets
Padde
padde
Master Developer
Master Developer
 
Posts: 443
Joined: Wed Apr 08, 2009 4:52 pm

Postby kris_xu » Wed May 06, 2009 2:10 pm

padde wrote:The picture seems to get resized.. your normal one is 128x128
the fuzzy one is 128x127.
Dont know where it gets resized because you provide no code or information
about the canvas itself.

Greets
Padde


i'm sorry ,the fuzzy one is cut from screen,not come from emulator file.
kris_xu
Freshman
Freshman
 
Posts: 5
Joined: Fri Apr 03, 2009 3:42 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 8 guests