Given a path to an image file, what’s the best way (on the fly) to create a thumbnail for that image?
The images would be around 200-300px squared. My initial thought was to just load a small region of the image, this works well but doesn’t always look so great.
BitmapRegionDecoder decoder = BitmapRegionDecoder.newInstance(new FileInputStream(file),false);
return decoder.decodeRegion(new Rect(0, 0, 100, 100),null);
As mentioned, the images were all roughly the same size (around 200px squared). Using the BitmapRegionDecoder I ended up loading a 100px thumbnail that was centred, this looks great and doesn’t involve any resizing.