Sub SavePicture (SourceDir As String, PicFilename As String, SaveDir As String)
' Copy the whole image to final dir
File.Copy(SourceDir, PicFilename, SaveDir, PicFilename)
' Make a thumbnail and save it to the \thumbs dir
Dim img As Image
Dim cvs As Canvas
cvs.Initialize("")
img.Initialize(SourceDir, PicFilename)
cvs.Height = img.Height
cvs.Width = img.Width
cvs.DrawImage(img, 0, 0, 200dip, 200dip)
Dim out As OutputStream = File.OpenOutput(SaveDir & "\thumbs", PicFilename, True)
cvs.snapshot.WriteToStream(out) ' Outputs as a PNG
out.Close
End Sub
Dim im As Image
Dim cells As ImageView
im.Initialize("c:/temp/","jelly.png")' the image (150 x 150)
cells.Initialize("")
Dim jo As JavaObject = cells
cells.SetImage(im)
jo.RunMethod("setFitWidth",Array(75.0)) ' width I want
jo.RunMethod("setFitHeight",Array(75.0)) ' height I want
jo.RunMethod("setPreserveRatio",Array(False))
Dim out As OutputStream = File.OpenOutput("c:/temp/", "jellyGrab.png", True)' now its 75 x 75
cells.snapshot.WriteToStream(out)
out.Close
Dim im As Image
Dim can As Canvas
im.Initialize("c:/temp/","jelly.png")' the image (150 x 150)
Dim jo As JavaObject
can.Initialize("")
jo = can
jo.RunMethod("setWidth",Array(75.0))
jo.runmethod("setHeight",Array(75.0))
can.DrawImage(im,0.0,0.0,75.0,75.0)
Dim out As OutputStream = File.OpenOutput("c:/temp/", "jellyGrab.png", True)
can.snapshot.WriteToStream(out)
out.Close
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?