[Gambas-user] 'Null object' when loading image from a .jpg file

John Rose john.aaron.rose at ...1601...
Wed Jan 18 19:42:52 CET 2012


 I get a popup window containing 'Null object' at runtime (which
unfortunately does not point at problem line of code, though I think that
it must be 'image = Image.Load(Dialog.Path)') with following code, when I
click ButtonImportImage:
 CodePublic Sub ButtonImportImage_Click()
  Dim image As Image
  Inc Application.Busy
  Dialog.Filter = ImageFileFilter(True)
  Dialog.Title = "Import Image"
  ' load image
  If Dialog.OpenFile() Then Return
  Print "import image path=", Dialog.Path
  image = Image.Load(Dialog.Path)
  ' save image & thumb to temp files
  SaveImageAndThumb(image)
  ButtonExportImage.Enabled = True
Finally
  Dec Application.Busy
Catch
  Message.Warning(ERROR.Text)
End
 On execution, TempImagePath is valid and points to a .jpg file which loads
with Graphics apps such as gThumbThumbViewer. I'm baffled as to the cause.
Any ideas?

Grasping at straws: I'm using Gambas3 with SQLite 3.6.22. I just noticed
that Gambas3 has a new component gb.image.io - image loading & saving. If I
try and select it (in Project Properties) it seems to be incompatible with
gb.gui, gb.gtk & gb.qt4. Perhaps it's needed for the Image.Load line - I
need to load an Image for the SaveImageAndThumb procedure (which is working
when called by another Sub).



More information about the User mailing list