Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use <strong>Bitmap.createScaledBitmap</strong> as others suggested.</p> <p>However, this function is not very smart. If you're scaling to less than 50% size, you're likely to get this:</p> <p><img src="https://i.stack.imgur.com/CGE3e.png" alt="enter image description here"></p> <p>Instead of this:</p> <p><img src="https://i.stack.imgur.com/pVFTd.png" alt="enter image description here"></p> <p>Do you see bad antialiasing of 1st image? createScaledBitmap will get you this result.</p> <p>Reason is pixel filtering, where some pixels are completely skipped from source if scaling to &lt; 50%.</p> <p>To get 2nd quality result, you need to halve the Bitmap's resolution if it's more than 2x larger than desired result, then finally you make call to createScaledBitmap.</p> <p>And there're more approaches to halve (or quarter, or eighten) images. If you have Bitmap in memory, you recursively call Bitmap.createScaledBitmap to halve image.</p> <p>If you load image from JPG file, implementation is even faster: you use <a href="http://developer.android.com/reference/android/graphics/BitmapFactory.html#decodeFile%28java.lang.String,%20android.graphics.BitmapFactory.Options%29">BitmapFactory.decodeFile</a> and setup Options parameter properly, mainly field <a href="http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html#inSampleSize">inSampleSize</a>, which controls subsambling of loaded images, utilizing JPEG's characteristics. </p> <p>Many apps which provide image thumbnails use blindly Bitmap.createScaledBitmap, and the thumbnails are just ugly. Be smart and use proper image downsampling.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload