All Projects → bansalayush → TakingImageOfAView

bansalayush / TakingImageOfAView

Licence: other
An example on how to take screenshot of a particular view

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to TakingImageOfAView

Gaussianblur
An easy and fast library to apply gaussian blur filter on any images. 🎩
Stars: ✭ 473 (+3053.33%)
Mutual labels:  canvas, bitmap, drawable
Html To Image
✂️ Generates an image from a DOM node using HTML5 canvas and SVG.
Stars: ✭ 595 (+3866.67%)
Mutual labels:  screenshot, canvas
Screenshott
[Android Library] Take a screenshot of your view layout , programmatically!
Stars: ✭ 311 (+1973.33%)
Mutual labels:  screenshot, bitmap
Image Screenshot
download an image node along with its css properties
Stars: ✭ 40 (+166.67%)
Mutual labels:  screenshot, canvas
dynamic-utils
Utility functions to perform dynamic operations on Android.
Stars: ✭ 86 (+473.33%)
Mutual labels:  bitmap, drawable
Android Toy
不积跬步 无以至千里
Stars: ✭ 54 (+260%)
Mutual labels:  canvas, drawable
Instacapture
Android library to capture screenshot from your app
Stars: ✭ 681 (+4440%)
Mutual labels:  screenshot, bitmap
screenshot
This library helps to take screenshot dynamically
Stars: ✭ 64 (+326.67%)
Mutual labels:  screenshot, android-application
Extract-Color-Palette-Api
Create gradient drawable by extracting prominent colors from image⚫⚪
Stars: ✭ 16 (+6.67%)
Mutual labels:  android-application, drawable
Paintview
An Android View with Gesture Supported for Painting
Stars: ✭ 136 (+806.67%)
Mutual labels:  screenshot, canvas
Drawablecolorchange
Android Library to dynamically change color of drawable.
Stars: ✭ 101 (+573.33%)
Mutual labels:  bitmap, drawable
Capturable
🚀Jetpack Compose utility library for capturing Composable content and transforming it into Bitmap Image🖼️
Stars: ✭ 365 (+2333.33%)
Mutual labels:  screenshot, bitmap
Quickshot
Capture images of any View, SurfaceView or Bitmap from your Android app in: .jpg .png or .nomedia with simple oneliner codes.
Stars: ✭ 663 (+4320%)
Mutual labels:  screenshot, bitmap
Capture Frame
Capture video screenshot from a `<video>` tag (at the current time)
Stars: ✭ 109 (+626.67%)
Mutual labels:  screenshot, canvas
ProminentColor
Android Library to get average/prominent color of bitmap/drawable
Stars: ✭ 23 (+53.33%)
Mutual labels:  bitmap, drawable
SeatLayout
A seat selection library for Android with an example for selecting seats for flights, sports venue, theatres, etc
Stars: ✭ 30 (+100%)
Mutual labels:  android-application, example-project
jmonet
An easy-to-use toolkit for incorporating MacPaint / Microsoft Paint-like tools into a Java Swing or JavaFX application.
Stars: ✭ 27 (+80%)
Mutual labels:  canvas
angular-openweather-app
A weather forecast app written in AngularJS
Stars: ✭ 54 (+260%)
Mutual labels:  example-project
screenshot-node
Takes a screenshot of selected area and saves it to disk
Stars: ✭ 20 (+33.33%)
Mutual labels:  screenshot
flutter-Anniversary
一款界面优美,功能简洁的纪念日APP
Stars: ✭ 57 (+280%)
Mutual labels:  android-application

TakingImageOfAView

If you want to take image of a particular View then follow this code

//Define a bitmap with height and width of the View
Bitmap viewBitmap = Bitmap.createBitmap(v.getWidth(),v.getHeight(),Bitmap.Config.RGB_565);

Canvas viewCanvas = new Canvas(viewBitmap);

//get background of canvas
Drawable backgroundDrawable = v.getBackground();

if(backgroundDrawable!=null){
backgroundDrawable.draw(viewCanvas);//draw the background on canvas;
}
else{
viewCanvas.drawColor(Color.GREEN);
//draw on canvas
v.draw(viewCanvas) 
}

//write the above generated bitmap  to a file
String fileStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
        OutputStream outputStream = null;
        try{
            imgFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),fileStamp+".png");
            outputStream = new FileOutputStream(imgFile);
            b.compress(Bitmap.CompressFormat.PNG,40,outputStream);
            outputStream.close();
        }
        catch(Exception e){
            e.printStackTrace();
        }

Don't forget to add this permission

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

This is very useful in cases like signature pads, where the user draws something and then wants to save an image of it.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].