JBIG2GBATX1 Example for Visual Basic

    Dim RasterFileDlg As New LEADRasterDlgFile_U
   Dim RasterKrnDlg As New LEADRasterDlgKrn_U
   
   LEAD1.UnlockSupport L_SUPPORT_JBIG2, L_KEY_JBIG2
   RasterKrnDlg.InitDlg 0
   
   LEAD1.Load "d:\temp\images\jpeg\golf.jpg", 0, 1, 1
   
   RasterFileDlg.DialogTitle = "Save a File"
   RasterFileDlg.FileDlgFlags = 0
   RasterFileDlg.InitialDir = "C:\"
   RasterFileDlg.SaveMulti = MULTIPAGE_OVERWRITE
   RasterFileDlg.UIFlags = SAVE_AUTOPROCESS Or _
                           SAVE_SHOW_FILEOPTIONS_PROGRESSIVE Or _
                           SAVE_SHOW_FILEOPTIONS_MULTIPAGE Or _
                           SAVE_SHOW_FILEOPTIONS_STAMP Or _
                           SAVE_SHOW_FILEOPTIONS_QFACTOR Or _
                           SAVE_SHOW_FILEOPTIONS_J2KOPTIONS Or _
                           SAVE_SHOW_FILEOPTIONS_BASICJ2KOPTIONS Or _
                           SAVE_SHOW_FILEOPTIONS_JBIG2OPTIONS
   RasterFileDlg.Bitmap = LEAD1.Bitmap
   
   nRet = RasterFileDlg.ShowSaveDlg(hWnd)
   If (nRet = 0 And RasterFileDlg.DialogStatus = DLG_OK) Then
      If (RasterFileDlg.SaveFormat = FILE_JBIG2 Or _
            RasterFileDlg.SaveFormat = FILE_RAS_PDF_JBIG2 Or _
            RasterFileDlg.SaveFormat = FILE_TIF_JBIG2) Then
            
         LEAD1.JBIG2ImageGBATX1 = RasterFileDlg.JBIG2ImageGBATX1
         LEAD1.JBIG2ImageGBATY1 = RasterFileDlg.JBIG2ImageGBATY1
         LEAD1.JBIG2ImageGBATX2 = RasterFileDlg.JBIG2ImageGBATX2
         LEAD1.JBIG2ImageGBATY2 = RasterFileDlg.JBIG2ImageGBATY2
         LEAD1.JBIG2ImageGBATX3 = RasterFileDlg.JBIG2ImageGBATX3
         LEAD1.JBIG2ImageGBATY3 = RasterFileDlg.JBIG2ImageGBATY3
         LEAD1.JBIG2ImageGBATX4 = RasterFileDlg.JBIG2ImageGBATX4
         LEAD1.JBIG2ImageGBATY4 = RasterFileDlg.JBIG2ImageGBATY4
         LEAD1.JBIG2ImageTemplateType = RasterFileDlg.JBIG2ImageTemplateType
         LEAD1.JBIG2ImageFlags = RasterFileDlg.JBIG2ImageFlags
         LEAD1.JBIG2ImageQFactor = RasterFileDlg.JBIG2ImageQFactor
         LEAD1.JBIG2TextGBATX1 = RasterFileDlg.JBIG2TextGBATX1
         LEAD1.JBIG2TextGBATY1 = RasterFileDlg.JBIG2TextGBATY1
         LEAD1.JBIG2TextGBATX2 = RasterFileDlg.JBIG2TextGBATX2
         LEAD1.JBIG2TextGBATY2 = RasterFileDlg.JBIG2TextGBATY2
         LEAD1.JBIG2TextGBATX3 = RasterFileDlg.JBIG2TextGBATX3
         LEAD1.JBIG2TextGBATY3 = RasterFileDlg.JBIG2TextGBATY3
         LEAD1.JBIG2TextGBATX4 = RasterFileDlg.JBIG2TextGBATX4
         LEAD1.JBIG2TextGBATY4 = RasterFileDlg.JBIG2TextGBATY4
         LEAD1.JBIG2TextTemplateType = RasterFileDlg.JBIG2TextTemplateType
         LEAD1.JBIG2TextFlags = RasterFileDlg.JBIG2TextFlags
         LEAD1.JBIG2TextQFactor = RasterFileDlg.JBIG2TextQFactor
         LEAD1.JBIG2TextMinSymArea = RasterFileDlg.JBIG2TextMinSymArea
         LEAD1.JBIG2TextMinSymWidth = RasterFileDlg.JBIG2TextMinSymWidth
         LEAD1.JBIG2TextMinSymHeight = RasterFileDlg.JBIG2TextMinSymHeight
         LEAD1.JBIG2TextMaxSymArea = RasterFileDlg.JBIG2TextMaxSymArea
         LEAD1.JBIG2TextMaxSymWidth = RasterFileDlg.JBIG2TextMaxSymWidth
         LEAD1.JBIG2TextMaxSymHeight = RasterFileDlg.JBIG2TextMaxSymHeight
         LEAD1.JBIG2TextDifThreshold = RasterFileDlg.JBIG2TextDifThreshold
         LEAD1.JBIG2YResolution = RasterFileDlg.JBIG2YResolution
         LEAD1.JBIG2XResolution = RasterFileDlg.JBIG2XResolution
         LEAD1.JBIG2Flags = RasterFileDlg.JBIG2Flags
         
         LEAD1.Save RasterFileDlg.FileName, RasterFileDlg.SaveFormat, 1, QFACTOR_LEAD_0, 0
      End If
   End If
   
   RasterKrnDlg.FreeDlg