How to efficiently resize image with antialias?

1.4k views Asked by At

I try to resize an image like this:

aPaint.setAntiAlias(true); // Enabling this flag will cause all draw operations that support antialiasing to use it.
aPaint.setFilterBitmap(True); // enable bilinear sampling on scaled bitmaps. If cleared, scaled bitmaps will be drawn with nearest neighbor sampling, likely resulting in artifacts.
apaint.setDither(true); // Enabling this flag applies a dither to any blit operation where the target's colour space is more constrained than the source.
aCanvas.drawBitmap(aBitmap, aJSrcRect, aJDestRectf, apaint);

But I don't have a very good antialised image (it's antialiased, but not very good). Here is an image showing my problem

enter image description here

What can i do to increase the quality of the antialias under android ?

1

There are 1 answers

1
Lazaros Papadopoulos On

For antialias effect, you can try to create a Paint like this:

Paint paint= new Paint();
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
paint.setAntiAlias(true);
paint.setFilterBitmap(true); 

Finally apply paint on canvas with:

canvas.drawBitmap(mBitmap, 0.f, 0.f, paint)