Saving Image(portion of it)

bdiscount

Active Member
Licensed User
The title says it all. Is there a way to save a section(x1,y1,x2,y2) of a image to a bmp file, not the whole form. I wrote a simple paint program over the weekend but need to be able to save a section to bmp for use in other programs. I also have a problem with setpixel etc.
What is B4pobject? I don't seem to have it.
Thanks
[email protected]
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Yes it is possible using the ImageLib library.
You should create a bitmap object and a drawer object that will draw over this bitmap.
Now draw the form's image on the bitmap using drawer.DrawImage1. It allows you to choose which part of the source image will be drawn.
Save the bitmap image using ImageLibEx (and bitmap.Value).
Only the bitmap object supports SetPixel.
B4PObject is a keyword that is sometimes required by other libraries.
For example:
B4X:
[FONT=Times New Roman][COLOR=#010101]drawer.New2 (ImageList1.Item(0), B4PObject(5))[/COLOR][/FONT]
 
Top