How make a framed Image?? i.e. put a frame around a bitmap Image??
the sample image is attached..
I have different frames. I want to put these frames around bitmap Images.. any suggestion will be helpful...
( I am developing an Image Processing application and want to put framed effect)
I assume you do not expect people to help you with code or you would have accepted some of the answers to your previous questions. So here is a start:
Create an image capable of being tiled as the background of the frame.
Create a new canvas that is (Picture.Width + 50px * 2) x (Picture.Height + 50px * 2) in size. Replace 50px with whatever you want the border size to be.
Tile your background image over the whole canvas.
Put your bitmap on the canvas at point (50, 50). Replace 50 with your actual border size.
Good luck.
Related
I was trying to do really the same functionality of resizing images like in MS Word.
I want to resize BufferedImage but I’m losing some information during process of resizing.
I tried to implement two approaches, but both produced same result.
Before any resizing:
Picture after few resize actions in my application:
First approach:
image = Thumbnails.of(image).size(w,h).asBufferedImage();
Second approach:
image = toBufferedImage(image.getScaledInstance(w, h, Image.SCALE_SMOOTH));
image is instance of BufferedImage, w is new width of image and h is new hight of image
Any idea, what I’m doing wrong?
You're constantly losing information from your image after each resizing attempt. If you want solution (like in MS Word) you have to keep somewhere original image but show only resized copy.
The best solution would be creating an object to store original image and making resized copy on demand. You can improve quality of this solution adding simple cache so you don't actually generate another resized copy of your image for every request but only if your application demands image with different height or width than last time.
I hope I helped you a bit.
I want to have a drawing canvas within my application which will display letter to free draw for practice. Something like the following:
OR
This is the first time I will be implementing this method so a few questions.
Can I have my own background for the canvas? (let's say a chalkboard?)
Do I have to create the letter as image and insert it onto the canvas as Bitmap?
I saw some tutorials but wasn't too clear on how to implement it within app.
I found a solution for you. Having more than 1 Canvas is not the answer (Although may work, I'm still new), but instead draw a seperate Bitmap on top of the first Bitmap (background).
Try this out for size: Overlying Bitmap
You should then be able to edit the overlaying Bitmap without affecting the original Bitmap.
Cheers!
I'd like to create a square thumbnail of an image using Java. I've already managed to resize images through a couple of ways. However I'd like to create a real square image, also from a non-square image.
Example: the source has a size of 200x400 (widht/height)
the target size is 100x100
The algorithm would then need to resize the image to 50x100 and add 25x100 pixels of whitespace each on the left and on the right.
Can anyone help me with this?
Just create a 100x100 background; add the scaled image to it. Use Math.max(width, height) to determine the scale factor. Then, plot the scaled image over the background, use calculations (offset x, offset y) to put it in the proper position.
For example: I have a bitmap 20x20, then I do some calculation and I need a new bitmap 30x30 with inside the old one for example in the center of the new bitmap. Is there a way to do that?
I'm creating an image dynamically using a canvas=canvas(mybitmap) but my image has no fixed dimensions. For example, I want to draw a path of a man into space. I create dynamically the image so that, if the man goesto east direction I will have a bitmap that grows in orizontal dimension (1x1 1x2 1x3....) andso on. if he turns to the north direction the bitmap must grow in vertical dimension (1x5 2x5 3x5).
I want not to redraw all the image but copy the old one into the new extended one and add only the new "data".
(I can't draw always on the same image because maybe I have to translate all the image and add some "space" in the first column or the first row of the bitmap")
Why not use a matrix to resize the bitmap?
If you can't just resize the one bitmap, why not still use a matrix then drawBitmap to your canvas(Bitmap) if you really need it done like that...
http://thinkandroid.wordpress.com/2009/12/25/resizing-a-bitmap/
I want to display the background image for one image view and text view.My problem is my background image should grow and shrink depending on it's child views without losing the image quality.
If you can define specific regions within your background that should stretch versus areas that should stay anchored in the same position regardless of size, 9-patches may be what you are looking for. These are perfect for creating resizable frames for content.
You can use setDensity(int density) method on Bitmap. You can change the density every time you want to change the size of the image.
http://developer.android.com/reference/android/graphics/Bitmap.html#setDensity(int)