This is very simple code to create thumbnail in android on run time.
public Bitmap convertSrcToBitmap(String imageSrc) { File imgFile = new File(imageSrc); byte[] imageData = null; Bitmap imageBitmap = null; if (imgFile.exists()) { try { final int THUMBNAIL_SIZE = 150; FileInputStream fis = new FileInputStream(imageSrc); imageBitmap = BitmapFactory.decodeStream(fis); imageBitmap = Bitmap.createScaledBitmap(imageBitmap, THUMBNAIL_SIZE, THUMBNAIL_SIZE, false); ByteArrayOutputStream baos = new ByteArrayOutputStream(); imageBitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos); imageData = baos.toByteArray(); } catch (Exception ex) { } } return imageBitmap; }
🙂