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

Benoît Minisini gambas at ...1...
Wed Jan 18 20:00:44 CET 2012


Le 18/01/2012 19:42, John Rose a écrit :
>   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).

Please provide a full project that reproduces your problem.

Regards,

-- 
Benoît Minisini




More information about the User mailing list