File f = new File(path);
BitmapFactory.Options o = new BitmapFactory.Options();
o.inSampleSize = 16;
try {
Bitmap bitmap = BitmapFactory.decodeStream(f.getInputStream(), null, o);
if (bitmap != null) {
Palette palette = Palette.from(bitmap).generate();
palette.getDominantSwatch() // dominant color
}
} catch (IOException ignored) {
}
沒有留言:
張貼留言