Android Question Draw on orginal photo keep size

MdW

New Member
Licensed User
Longtime User
Hi,

I want to draw on an orginal photo and save this keeping the orginal sizes.

So if I have a image from 1024x768 and a device screen of 800x400 I would see the whole image that fits on the screen and draw on it whereafter I would save this (inclusive the drawings) into an image with the orginal sizes (1024x768)

I played around with it but I don't no how to do this. Has someone an idea how to solve this?

This is what I tried so far:

Dim bm As Bitmap
Dim iv As ImageView
Dim c As Canvas

bm = LoadBitmap(File.DirAssets, "photo.jpg")

iv.Initialize("")
iv.Gravity = Gravity.FILL
iv.Bitmap = bm

Activity.AddView(iv, 0, 0, 100%x, 100%y)

iv.Width = bm.Width
iv.Height = bm.Height

c.Initialize(iv)

'save new image
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal, "NewPhoto.jpg", False)
c.Bitmap.WriteToStream(out, 100, "JPEG")
out.Close
 

sorex

Expert
Licensed User
Longtime User
you need to put the image in a panel as that has touch events to get back the position where it has been pressed.

you also need to use a convas to draw on and that is attached/linked to that image.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You can also use an could based solution with a simple php-script.
 
Upvote 0

MdW

New Member
Licensed User
Longtime User
Thanks for help.

I solved this problem to set the panel weight and height to the sizes of the scaled bitmap after initialize canvas. By drawing I had to scale the x and y positions as well.
 
Upvote 0
Top