Page 1 of 1

Why the image is not showing on the GUI?

Posted: Wed Oct 17, 2018 7:42 am
by stmdbe2019
Why the image is not showing?

Code: Select all

;UsePNGImageDecoder()
;UseJPEGImageDecoder()

If FileSize("fcom.jpg")= -1
  InitNetwork()
  ReceiveHTTPFile("http://www.idlearts.com/images/legion.jpg","fcom.jpg")
EndIf


If OpenWindow(0, 100, 200, 195, 260, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
  
  ;ImageGadget(0, 5, 20, 30, 230, img1, #PB_Image_Border)
  img1 = LoadImage(#PB_Any,"fcom.jpg")
  If img1
    width = ImageWidth(img1)
    height = ImageHeight(img1)
    ;ResizeWindow(0,0,0,width,height)
    ImageGadget(0,5,20,30,230,ImageID(img1),#PB_Image_Border)       
  EndIf 

  Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1
  
EndIf

End

Re: Why the image is not showing on the GUI?

Posted: Wed Oct 17, 2018 8:26 am
by Denis
It's a gif file format.

Use UseGIFImageDecoder()

Re: Why the image is not showing on the GUI?

Posted: Wed Oct 17, 2018 8:54 am
by stmdbe2019
Thank you. It worked.