Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take filtered image as Bitmap #17

Open
gkakasevski opened this issue Sep 3, 2014 · 2 comments
Open

Take filtered image as Bitmap #17

gkakasevski opened this issue Sep 3, 2014 · 2 comments

Comments

@gkakasevski
Copy link

Hi all, I need the filtered image as Bitmap object at the end. How can I do that?

@ghost
Copy link

ghost commented Sep 4, 2014

Hi gkakasevski,
You can use code below:

BitmapOutput output;

public void getBitmap(){
GaussianBlurFilter gauu = new GaussianBlurFilter(2.0f);
gauu.addTarget(screen);
pipeline.pauseRendering();
input.addTarget(gauu);
pipeline.startRendering();
output = new BitmapOutput(new BitmapOutputCallback() {

            @Override
            public void bitmapCreated(Bitmap bitmap) {
                // TODO Auto-generated method stub
                // Bitmap will return in this.
                                    saveFileShare(bitmap);
            }
        });
        gauu.addTarget(output);
        view.requestRender();

}

public void saveFileShare(Bitmap bm) {
if (!PATH_SHARE.exists())
PATH_SHARE.mkdir();
Date dateNow = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss");
String datetime = dateFormat.format(dateNow);
String imageName = datetime + ".png";
String fileImageShare = PATH_SHARE.getPath() + File.separator + imageName;
FileOutputStream out = null;
try {
out = new FileOutputStream(fileImageShare);
bm.compress(Bitmap.CompressFormat.JPEG, 80, out);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
} catch (Throwable ignore) {
}
}
}

Have a nice day!

@gkakasevski
Copy link
Author

Tnx a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant