Created
September 16, 2015 09:10
-
-
Save brianhsu/8b2f3ec0599c9cb95589 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val ResizeFactor(originWidth, originHeight, factor) = ImageSampleFactor(fixedURL, thumbnailSize, thumbnailSize) | |
| val options = new BitmapFactory.Options | |
| options.inSampleSize = factor | |
| if (originWidth <= 48 || originHeight <= 48) { | |
| options.inDensity = 160 | |
| options.inScaled = false | |
| options.inTargetDensity = 160 | |
| } | |
| val imgStream = new URL(fixedURL).openConnection().getInputStream | |
| val imgBitmap = BitmapFactory.decodeStream(imgStream, null, options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment