OptimizeBuffer Example for Visual Basic
Dim WithEvents ImageOptmizer As LEADRasterImgOpt
Private Sub ImageOptmizer_OnOptimize(ByVal nPercent As Integer)
MsgBox nPercent, , "Optimizing"
End Sub
Private Sub Optimize_Click()
Dim nRet As Integer
Dim RasterIO As New LEADRasterIO
Dim OrgData As New LEADRasterVariant
Dim OptData As LEADRasterVariant
Dim OptimizeOptions As LEADOptimizeOptions
RasterIO.Load LEADRasterView1.Raster, "c:\slices\eye.gif", 0, 0, 1
Set OrgData = RasterIO.SaveArray(LEADRasterView1.Raster, FILE_JPEG, 24, QFACTOR_LEAD_0)
Set OptimizeOptions = ImageOptmizer.DefaultOptions
OptimizeOptions.Distance= 1
OptimizeOptions.JPEGColorSpace = JPEG_COLOR_SPACE_422
OptimizeOptions.Percent = 50
OptimizeOptions.PickSamePalette = True
OptimizeOptions.PNGQFactor = 8
OptimizeOptions.JPEGQFactor = 128
nRet = ImageOptmizer.OptimizeBuffer(OrgData, OptData, OptimizeOptions, True)
If (nRet = 0) Then
RasterIO.LoadArray LEADRasterView2.Raster, OptData, 0, 0, -1, OptData.ItemCount
End If