Android : Way To Write A Bitmap To Outputstream?

Aug 22, 2009

Is there a way to write a bitmap image into an outputstream other than the below method. myView.mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputstream); While using the above method there is a loss in quality of the pic for JPEG formats, however for PNG images it is fine.
Regards, R.Karthik

Android : Way to Write a Bitmap to outputstream?


Android :: Write Comment On Bitmap

Nov 22, 2010

I have a bitmap displayed on ImageView now i want to give a facility to write comment typed by the user on that bitmap.i tried using Canvas canvas = new Canvas(srcBitmap); canvas.drawText("Hello", 100,100,null);but this is giving me following error java.lang.IllegalStateException: Immutable bitmap passed to Canvas constructor later on i want to save this whole image a bitmap.

View 1 Replies View Related

Android :: How To Write Bitmap Out To XML File

Jan 21, 2010

Might sound crazy, but it's what I need to do. I want to take a Bitmap object and use the XMLPullParser/XmlSerializer to write this to a flat file. Obviously I will need to read the XML tag back into a Bitmap object.So somehow I have to turn my Bitmap into a String and then turn that String back into a Bitmap. I will do some searches on Base64 to see if I get any good examples.

View 2 Replies View Related

Android :: Can't Close InputStream And OutputStream / Do It Completely?

Nov 5, 2010

I connected to a server after then, to close InputStream and OutputStream call the code...

But, the streams is still alive. If I make once again, there are 2 different InputStream. Exception does not happen.

How to completely close the streams?

View 1 Replies View Related

Android :: Pass Socket - Inputstream - Outputstream Objects Between Activities

Jun 29, 2010

How to pass socket, inputstream, outputstream objects between activities

View 1 Replies View Related

Android : Crop Bitmap Without Reading Entire Bitmap / Cannot Read Image Into Memory

Jul 21, 2010

I have a very large image and I only want to display a section the size of the display (no scaling), and the section should just be the center of the image. Because the image is very large I cannot read the entire image into memory and then crop it. This is what I have so far but it will give OutOfMemory for large images. Also I don't think inSampleSize applies because I want to crop the image, not lower the resolution.

Uri data = getIntent().getData();
Input Stream is = getContentResolver().openInputStream(data);
Bitmap bitmap = BitmapFactory.decodeStream(is, null, null);

Any help would be great?

View 3 Replies View Related

Android :: Create Mutable Bitmap From Camera - Draw Another Bitmap On Top - And Save It

Apr 2, 2009

I am 1) taking a picture and 2) then draw another Bitmap on top of it 3) then I store it

I am doing it as follows and it works on the emulator.

On the device I get a OutOfMemoryError: bitmap size exceeds VM budget android.graphics.Bitmap.nativeCopy(Native Method) android.graphics.Bitmap.copy(Bitmap.java:199) in the line copy the Bitmap to get a mutable Bitmap.

CODE:...........

What I am asking:

a) Is there a better way to do what I am doing? 1) take a picture 2) draw another Bitmap on top of it 3) then I store it

b) What is the best way to create a mutable Bitmap from the picture I just took with the camera?

In my app, resolution is not an issue. If it works better for small photos that would be fine.

View 3 Replies View Related

Android :: Overlay Bitmap - Draw Over A Bitmap

Oct 8, 2009

I have two questions actually:

Is it better to draw an image on a bitmap or create a bitmap as resource and then draw it over a bitmap? Performance wise... which one is better?

If I want to draw something transparent over a bitmap, how would I go about doing it?

If I want to overlay one transparent bitmap over another, how would I do it?

View 1 Replies View Related

Android :: Draw A Bitmap Rotated Onto Another Bitmap

Mar 22, 2009

My goal is the draw a bitmap onto another bitmap but rotated 90 degress. whats the most efficient way to do that. My current method is as follows which is horribly bad because it creates a new bitmap every time.

CODE:.....................

View 4 Replies View Related

Android :: Draw Shape Or Bitmap Into Another Bitmap - Java - Android

Jun 22, 2010

I want to draw a shape(many circles particularly) into a Specific Bitmap. I have never used canvas / 2D graphs etc. As i see it i create a Drawable put the bitmap in it then "canvas-it" to the shapes i want etc.

View 1 Replies View Related

Android :: Draw On Bitmap

Nov 11, 2010

I'm trying to figure out how to draw on a bitmap in android, and keep a copy of these changed bitmaps for an undo function.

Bitmap b = ...
Paint p = new Paint();
canvas.drawBitmap(b, new Matrix(), null);
canvas.drawCircle(0,0,20,20);
//does Bitmap b have the circle drawn on it next time?

Or how do I get the bitmap after its been drawn on with the canvas(I want to preserve a stack of bitmaps with the changes applied by canvas drawing)? Maybe I'm going about this entirely wrong.

View 1 Replies View Related

Android :: Trying To Grayscale Bitmap?

Apr 20, 2009

I am trying to grayscale bitmap as follows, But it is crashing as soon as I run this method.

The problem is in last line. How can I assign "int" to "Color"? Or are there any better ways?

CODE:................

View 9 Replies View Related

Android :: Getting Bitmap From TextView

Jun 13, 2010

I want to get the bitmap that is drawn when a textview is displayed but without displaying the textview in the activity. something like this:

TextView t = new TextView(this);
t.forceToDrawItself();
Bitmap b=t.getViewBitmap();

how is this possible?

View 2 Replies View Related

Android : How To Put Bitmap On Top Of A Button?

Apr 21, 2009

Does anybody knows how can I put a Bitmap on top of a button, but without taking the whole surface?

View 2 Replies View Related

Android : Best Way To Resize Bitmap

Sep 10, 2009

I want to resize a bitmap and write to a file. what's the best way to do that?

View 2 Replies View Related

Android : How To Merge Two Bitmap Into One

Mar 15, 2010

I have two different bitmap. Can I merge these two bitmap into one?

View 7 Replies View Related

Android :: Passing Bitmap To Another Activity

Jun 7, 2010

I have a Bitmap image and i want to forward the bitmap to another activity. I have two activities Activity A and Activity B. This is how I started the Activity B
startActivityForResult(new Intent(Activity A.this, Activity B.class), 120);
in activity B
private void forwardImage(Bitmap bit) {
Intent i = new Intent(MMS.this, Compose.class);
i.putExtra("MMS", bit);
setResult(RESULT_OK, i);
finish(); }

This is not forwarding to Activity A but if I put a String to the intent it'll forward. This is how I listen to result in Activity A

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
// super.onActivityResult(requestCode, resultCode, data);
switch (resultCode)
case RESULT_OK: Intent intent = getIntent();
Bitmap bitmap = (Bitmap) intent.getParcelableExtra("MMS");
mmsImage.setImageBitmap(bitmap);
default: break;
} }

How can I pass a bitmap.

View 3 Replies View Related

Android :: Replace Any Colour In Bitmap Possible?

Oct 28, 2010

Is there an easy way to replace a colour in a bitmap?

View 2 Replies View Related

Android :: Converting Bitmap To Grayscale

May 20, 2009

I would like to convert a Bitmap to a grayscale array of bytes (one byte per pixel). At the same time I want to just crop at section from the middle. Having looked though the various api's it is not clear to me what the best way would be.

1) What is ALPHA_8? is that grayscale? I have a feeling that the grayscale effect should be done via some "saturation" on the paint object, right?

2) once I have the Bitmap in grayscale and the right size, what is the best way to get that to a byte[] of pixels (one byte per pixel)?

View 2 Replies View Related

Android :: Converting Bitmap To ASCII

Sep 17, 2010

I have a picture taken using the phone's camera and in bitmap format. I want to send it over HTTP usinf Http post in ASCII.Any idea how to do it?

View 4 Replies View Related

Android :: Why Bitmap Is Placed On An An Imageview Incorrectly?

Nov 24, 2010

this problem has been bothering me for days and I cannot figure out why on earth it is happening. I have a method that detects for a face, if a face is detected, the method will draw a rectangle on a canvas along the face.That part works fine.The problem is, when it displays to the image_view in my xml file, it will display on the far left middle of the image view, in a box, rather than in the center with the width as fill_parent.I thought of a possible workaround : to set the bitmap as a bitmapdrawable, but canvas only draws to bitmaps, so I can get the bitmapdrawable in the middle, but with no red box around it.I commented out my testing of bitmap drawable, and left it as what I have now...it only displays to my xml in the far left of the image_view.

View 1 Replies View Related

Android :: RuntimeException On Widget That Has A Bitmap

Aug 23, 2010

my app has widgets that have an ImageView and a TextView. On the onUpdate() method of the WidgetProvider, I put a Bitmap inside the ImageView this way:

CODE:..................

setColor() method is this:

CODE:..........

The problem is that sometimes the widget throws a RuntimeException because somebody has recycled the Bitmap, and I don't know what to do.

View 2 Replies View Related

Android :: Batch Getting Many Bitmap Resources?

Jan 24, 2010

I have a long series of graphics -- icon1_0.png, icon1_1.png, icon1_2.png..., icon12_0.png, icon12_1.png, icon12_2.png -- and I'd like to package them with my android application. Ideally I think I should be able to load them as resources but the resource id's are set up as java identifiers. Of course, java identifiers can't be assembled at runtime. I have to ask for R.drawable.icon12_00 so I cannot set up a loop

for(int icon=0;icon<12;icon++)
for(int frame=0;frame<3;frame++)
//syntax error obviously
BitmapFactory.decodeResource(getResources(), R.drawable."icon" + icon + "_" + frame + ".png");

So is there any way to get resources by their names? Better yet, is there a canonical way outside the resource system to pack data files into an android application package so that I can get at them? I'm thinking about reflection but that doesn't seem like the right solution to me.

View 3 Replies View Related

Android :: Temp Storage For Bitmap

Oct 13, 2009

My program creates a bitmap and successfully stores it on external storage (Images.Media.EXTERNAL_CONTENT_URI).

The next option to implement is to share the image. I'm thinking about different way of doing it: 1. Save it as captured image (as before) and startActivity with Intent.ACTION_SEND intent with the saved image uri. 2. Save it in application's home directory (getFileStreamPath()), startActivityForResult as in 1. and I hope that I'll recieve a result when the message is sent. 3. Save it in some kind of temp/cache folder and don't bother about deleting it or delete it as in 2.

Personally I prefer the second option.

My questions are: Will it work with startActivityForResult() as in 2. ? Do I have access to temp/cache folder as in 3. ? If I do, Should I delete the file afterwards ? May be some flag for Intent.ACTION_SEND to delete the file afterwards ?

View 6 Replies View Related

Android :: Draw Text On A Bitmap

Jun 14, 2009

Can i draw text on a bitmap? I cannot find any API support this.

View 4 Replies View Related

Android :: Draw GLSurfaceView To A Bitmap

Nov 4, 2009

I have an application that uses GLSurfaceView to draw OpenGL ES graphics. This is all working (mostly) how I would expect.

Now, I would like to implement a screenshot feature. For normal views, it seems that the standard practice is to create a new Canvas with a Bitmap and then draw to that Canvas using View.onDraw(Canvas).

I've tried using SurfaceView.draw(Canvas) in a similar fashion, but it always results in a blank (black) image.

I've also tried using the drawing cache with the exact same result.

View 3 Replies View Related

Android :: Draw A Bitmap Image?

Dec 2, 2009

Any one know about how to draw a bitmap image?...

View 6 Replies View Related

Android :: Draw Bitmap On Overlay

Nov 12, 2009

I've been trying almost everything and been searching and reading everywhere on the net. I just can't seem to find the correct way of doing this.

I have a MapActivity with a MapView and I want to draw something on an Overlay. I'm overwriting the draw-method, and I can easily draw straight on the canvas using a paint. My problem is I want to merge some circles and afterwards color them. Therefore I want to create a Bitmap and then draw on that. I just don't know what to use. Should I use a mutable Bitmap, a BitmapDrawable or am I simply going in the wrong direction.

The reason I want to do this is because I want to draw some kind of heatmap upon the Google Maps, and I need to merge and blend different circles, so they appear to be just one big blob.

View 6 Replies View Related

Android :: Draw A Piece Of Bitmap

Mar 9, 2009

I'm creating a simple game for Android and faced with a problem: Idea is to have a huge "map" image file and re-draw only small part of it (320*480) depending on user actions.

I didn't find a better solution than using "public static Bitmap createBitmap (Bitmap source, int x, int y, int width, int height)" method and decided to try it (expected huge performance degradation), but actually it's appeared that this method changes source bitmap and when i call it second time source size is significantly reduced. For instance this code:

CODE:.................

View 4 Replies View Related

Android :: Draw A Bitmap - Using OpenGL

Aug 30, 2010

I have a byte array of RGB values, just like the contents(without header) of a *.bmp file. What I want to do is, draw the corresponding bitmap on Android, using OpenGL.

It seems that OpenGL ES doesn't have a single API that will do, it true?

If true, how can I do this?

Actually, I can draw it in JAVA code, but it's too slow and costs too much CPU time. So I want to try drawing it with OpenGL. Is there any other advises? Or maybe OpenGL can't be the right answer?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved