Android Question Picture compression problem

cxdzbl

Active Member
Licensed User
The original photos about 4MB, I library resize image 1.1 reduce photos (248dip), picture size at about 130 and is not clear. However, appear in the other networks in the resolution of the picture high but only 60kb or so, I ask why? Is there any other way?
 

Widget

Well-Known Member
Licensed User
Longtime User
If you want to resize a photo outside of Android (say on Windows), try Paint.Net. It does a good job at resizing images. Get a free copy from http://www.getpaint.net/index.html

You didn't say what format the image was in. If it is JPEG you may have too much compression on the image. It is best to resize the image first with Paint.Net then save it as PNG or JPEG before you play with the level of compression. That way you can always go back to the original uncompressed image.
 
Upvote 0

cxdzbl

Active Member
Licensed User
If you want to resize a photo outside of Android (say on Windows), try Paint.Net. It does a good job at resizing images. Get a free copy from http://www.getpaint.net/index.html

You didn't say what format the image was in. If it is JPEG you may have too much compression on the image. It is best to resize the image first with Paint.Net then save it as PNG or JPEG before you play with the level of compression. That way you can always go back to the original uncompressed image.


I think in the phone selection (. JPG) photos uploaded to my server, in order to reduce the space and upload speed of the server, I need at the end of the phone will select the photos are compressed as much as possible, small (<100k), but it is not clear. However, like the other network down the picture, the document is very small (<100k), is also very clear
 
Upvote 0

Widget

Well-Known Member
Licensed User
Longtime User
I think in the phone selection (. JPG) photos uploaded to my server, in order to reduce the space and upload speed of the server, I need at the end of the phone will select the photos are compressed as much as possible, small (<100k), but it is not clear. However, like the other network down the picture, the document is very small (<100k), is also very clear

There are 2 ways to reduce the size of a jpeg image.
  1. Reduce the size of the image. If you are displaying the image on a phone, you probably don't need an image that is 1280x1024. You will be able to get by with an image that is closer to the size of the screen resolution for the phone or tablet. (Assuming the user does not need to zoom in on the image.) You can use B4A's LoadBitmapSample to load a JPG file and resize it if it is larger than MaxWidth & MaxHeight.

    LoadBitmapSample(Dir As String, FileName As String, MaxWidth As int, MaxHeight As int) As BitmapWrapper

  2. Increase the compression of the JPG by decreasing the quality of the image. This will cause a blurry picture if you compress the image too much. How much is too much? It depends on the image.
    This link might help you to decide: http://www.ampsoft.net/webdesign-l/jpeg-compression.html
I'd recommend you download the image that you think is sharp, to your PC. Download IrfanView from http://www.irfanview.com and install the program. Run IrfanView and open the image that looks sharp. From the main menu select Image > Information and take a look at the image's "Current Size", "Compression", "Resolution", "Current Colors", "Disk Size". These are the image settings you will want to try and achieve using B4A.

Now download the image that looks fuzzy and display it's information using IrfanView. See which of these image properties are considerably lower than your perfect image. It shouldn't be too hard to determine what is causing the poor image quality. Repeat the process on several more images just to be sure.

I hope this helps.
 
Upvote 0

cxdzbl

Active Member
Licensed User
There are 2 ways to reduce the size of a jpeg image.
  1. Reduce the size of the image. If you are displaying the image on a phone, you probably don't need an image that is 1280x1024. You will be able to get by with an image that is closer to the size of the screen resolution for the phone or tablet. (Assuming the user does not need to zoom in on the image.) You can use B4A's LoadBitmapSample to load a JPG file and resize it if it is larger than MaxWidth & MaxHeight.

    LoadBitmapSample(Dir As String, FileName As String, MaxWidth As int, MaxHeight As int) As BitmapWrapper

  2. Increase the compression of the JPG by decreasing the quality of the image. This will cause a blurry picture if you compress the image too much. How much is too much? It depends on the image.
    This link might help you to decide: http://www.ampsoft.net/webdesign-l/jpeg-compression.html
I'd recommend you download the image that you think is sharp, to your PC. Download IrfanView from http://www.irfanview.com and install the program. Run IrfanView and open the image that looks sharp. From the main menu select Image > Information and take a look at the image's "Current Size", "Compression", "Resolution", "Current Colors", "Disk Size". These are the image settings you will want to try and achieve using B4A.

Now download the image that looks fuzzy and display it's information using IrfanView. See which of these image properties are considerably lower than your perfect image. It shouldn't be too hard to determine what is causing the poor image quality. Repeat the process on several more images just to be sure.

I hope this helps.


Thank you for your advice, I would like to use the LoadBitmapSample library to try, but now there is no example, I think I have to look at.
 
Upvote 0

Widget

Well-Known Member
Licensed User
Longtime User
Thank you for your advice, I would like to use the LoadBitmapSample library to try, but now there is no example, I think I have to look at.

Just search the forums for LoadBitmapSample and you will have dozens of posts and several tutorials.
 
Upvote 0
Top