문제

I'm trying to create high quality thumbnails, have tried most-if-not-all methods with Android and not yet satisfied.

Here is a good post I found, in which I would like to try using Scalr or 'java-image-scaling' library for Android.

Here are Scalr and 'java-image-scaling'

Question: Can I use them in Android dev and How? (since I didn't see it mentions anywhere)

도움이 되었습니까?

해결책

Its not possible to use Scalr with android because it uses java.awt.image.BufferedImage, which isn't part of the Android SDK (neither is the rest of java.awt).

Android uses android.graphics.Bitmap, not BufferedImage. I've yet to find as good of a library for Android as Scalr, but the Bitmap class support scaling, rotations and other transformations pretty well, look at createBitmamp with the matrix parameter.

For example, the following code flips a bitmap, then saves it in another bitmap

Matrix mirrorMatrix = new Matrix();
mirrorMatrix.preScale(-.5f, .5f);
// Create a flipped sprite using the transform matrix and the original sprite
flippedBitmap = Bitmap.createBitmap(orgBitmap, 0, 0, orgBitmap.getWidth(), orgBitmap.getHeight(),mirrorMatrix, true);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top