Comments (9)
Just to be clear, I try this with the press of a button after I've drawn some lines I call drawableView.obtainBitmap(), that's it.
from drawableview.
I'll check it asap. 👍
from drawableview.
Hi, @Odaym show me your code to obtain the bitmap, I'm trying saving the bitmap with the sample and is working Ok.
from drawableview.
What I'm trying to do with this is allow the user to draw something over an ImageView with a picture loaded in the Activity. Upon pressing Save, I grab the bitmap from drawableView and I grab the picture loaded into the ImageView and I combine them and save them as one image.
For now, the code below stores the bitmap from the drawableView onto the device and loads it instead of the picture in the ImageView (instead of the picture that was there), this is just for testing whether the bitmap will be saved or not.
And the file I linked to above I got it from going to the device and seeing the saved file of the bitmap, but it was empty
fabActionUndo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Picasso.with(Test_Activity.this).load(new File(storeImage(drawableView.obtainBitmap()))).into(tstImageView);
//sometimes I call clear just to see only the imageview without the stuff I've just drawn on the bitmap. Whether it's there or not, same outcome happens with empty image file
//drawableView.clear();
}
});
private String storeImage(Bitmap image) {
File pictureFile = createImageFile();
if (pictureFile == null) {
Log.d("TAG",
"Error creating media file, check storage permissions: ");
return "";
}
try {
FileOutputStream fos = new FileOutputStream(pictureFile);
image.compress(Bitmap.CompressFormat.PNG, 90, fos);
fos.close();
} catch (FileNotFoundException e) {
Log.d("TAG", "File not found: " + e.getMessage());
} catch (IOException e) {
Log.d("TAG", "Error accessing file: " + e.getMessage());
}
Log.d("IMAGE", "PATH OF DRAWABLE VIEW IS : " + pictureFile.getAbsoluteFile());
return pictureFile.getAbsolutePath();
}
from drawableview.
Chris, the feature/limit_canvas_size branch included the fix for this issue. I didn't change any code at all from what I pasted above when I ran the project. I just wanted to test the canvas height and thought I'd also try the obtainBitmap() cause you said it was working fine. So I found it working fine, strangely
from drawableview.
Ok, re-open this if the issue returns.
from drawableview.
Hi Chris, today I just pulled 0.6.0 and it worked fine and included both fixes that were in limit_canvas_size, I don't have to import that branch as a library anymore. Just wanna thank you 👍
from drawableview.
thanks to you for using it :)
from drawableview.
Hi Chris, Sorry for bringing up the topic again. I'm having similar issue saving the background image with the drawn paint together onto the same bitmap. Hope you can offer me some advice on that. Thanks
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(resultCode == RESULT_OK){
if(requestCode == CAMERA_REQUEST){
OriginalBitmap = getRotatedBitmap(bitmap,90);
drawableView.setBackground(new BitmapDrawable(getResources(), OriginalBitmap));
config.setStrokeColor(Color.BLUE);
config.setShowCanvasBounds(true);
config.setStrokeWidth(50.0f);
config.setCanvasHeight(height);
config.setCanvasWidth(width);
drawableView.setConfig(config);
}
}
}
ivSavesetOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
OriginalBitmap = ImageLoader.init().from(selectedPhoto).requestSize(512,512).getBitmap();
try {
OriginalBitmap = drawableView.obtainBitmap(OriginalBitmap);
// Tried OriginalBitmap = drawableView.obtainBitmap(); however, on the server it store only the drawn bitmap and internal memory only the background image.
storeImage(OriginalBitmap);
}
catch (IOException e) {
e.printStackTrace();
}
}
String encodedImage = ImageBase64.encode(OriginalBitmap);
from drawableview.
Related Issues (20)
- supporting adding text
- Thanks guy!
- setBackgroundColor does not have an effect on the obtained bitmap HOT 2
- [SOLVED] Black Image in saved bitmap HOT 3
- appear android.os.BadParcelableException error HOT 2
- Saving Background bitmap with drawn paint causes the app to crash? HOT 1
- Maven Central artifact is dirty
- Drawableview no track
- Can we set a bitmap as the canvas background? HOT 1
- :( HOT 1
- Run very very slow if you use a background
- Disable Touch Listener
- Referenced class is missing
- How to set the color that has been drawn?
- what is the Lib version and the mvn central badge HOT 1
- ERROR: Failed to resolve: me.panavtec:drawableview:0.6.0
- Can't draw if widget are inside NestedScrollView
- Parcelable protocol requires that the class implements Parcelable
- Ability to center canvas on w/h of the view HOT 7
- Set a color for background and canvas border
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drawableview.