简体   繁体   中英

How to sharpen Image/Bitmap in Android Studio

I need to sharpen the image quality of an image in Android Studio. The Source of the images is from a PDF file.

Note: When I zoom in on the page - the image sharpens and when I view the entire page in a single page, it is extremely blurry.

How can I sharpen the image quality using? I have read some articles on BitmapFactory, but I am not clear on how to implement it. I am still fairly new to android and I am feeling my way around.

Below is my code in the app:

 private void showPage(int index) {
        if (mPdfRenderer.getPageCount() <= index) {
            return;
        }

        if (null != mCurrentPage) {
            mCurrentPage.close();
        }

        Bitmap bitmap = Bitmap.createBitmap(mCurrentPage.getWidth(), mCurrentPage.getHeight(),
                Bitmap.Config.ARGB_8888);

        mCurrentPage.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);

        mImageView.setImageBitmap(bitmap);
        updateUi();
    }

Thanks!

I found that if I re-scale the image manually to a larger dpi size, it works. However, this solution does not fit what I need from a business standpoint.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM