When we encounter a dual-sided scanner during image processing in the hospital, we need to divide the two scanned images into one and print them. In the process of image segmentation, there is always no way to do this. Although cbm666 was provided later, it was not very convenient. When I Accidentally flipped through a VB book, I saw an example using the Microsoft Picture clip control. It was super easy to split the image. Share the following code to make sure you can use it.
'Reference the Microsoft Picture clip control and place it named pic1
'Split 009.jpg vertically into 2 parts and save it to the local tmp1 tmp2
Pic1.picture = loadpicture (App. Path + "\ 009.jpg ")
Pic1.cols = 2
Pic1.rows = 1
Picture1 (0). Picture = pic1.graphiccell (0)
Picture1 (1). Picture = pic1.graphiccell (1)
'The Image saved in this way is a bitmap, which will be very large.
Savepicture picture1 (0). Picture, app. Path + "\ tmp1.jpg"
Savepicture picture1 (1). Picture, app. Path + "\ tmp2.jpg"
'You can use the following picbuf controls for image compression and storage, and you need to register the ik32.ocx Control
'You can also leave the image to picturebox without saving it.
Pica. Picture = pic1.graphiccell (0)
Picb. Picture = pic1.graphiccell (1)
CallSavepic (PICA, "tmp1 ")
CallSavepic (picb, "tmp2 ")
Private SubSavepic (ByvalControlAsPicbuf,ByvalFilenameAs String)
Control. imageformat = ik_jpeg
Control. writecompression = 85
Control. filename = app. Path + "\" + filename + ". jpg"
Control. Store
End Sub
The cbm666 method for separating large images is provided, but the preceding controls are not flexible and convenient: