Xojo App won't open jpg file.

I have a web app that takes a photo using the Pi camera and then loads it into the page for display. It works if I use a png file but crashes if the file is jpg.

I have run exiftool on the jpg file and it reports

Compression : JPEG (old-style)

Could this be an issue? Is Xojo not able to recognise this compression?

I need jpegs rather than pngs because they contain exposure data and pngs do not.

Is it a crash or an exception?

Also, have you tried a remote debug to see if it breaks into the debugger at that point?

I’m in the process of checking that. I’ll get back to you shortly.

It seems to be crashing.

I’m writing a syslog debugging message directly before the file open

System.Log(System.LogLevelDebug, "About to open the image.")
p = Picture.Open(App.LatestImage)
System.Log(System.LogLevelDebug, "Image open.")

That’s enclosed in a try/catch block that includes

Catch e 
    System.Log(System.LogLevelError, "We had an exception!  -  " + e.Message)
End Try

and there is a similar syslog in the App’s UnhandledException event.

The only message that appears in the log is “About to open the image.”

It must be something more subtle than the compression format. The following code run as a desktop app successfully opens and displays the image in an image well on both Mac and Raspberry Pi.

Dim f As FolderItem
Dim p As Picture
#If TargetLinux Then
  f = New FolderItem("test.jpg", FolderItem.PathTypeNative)
#Else
  f = New FolderItem("/Volumes/PiProjects/SkyCamImages/test.jpg", FolderItem.PathTypeNative)
#EndIf
If f = Nil Then
  MsgBox("FolderItem is Nil.")
End If
If Not f.exists Then
  MsgBox("Image not found at " + f.NativePath)
End If
MsgBox("About to open the image.")
If f <> Nil And f.Exists Then
  p = Picture.Open(f)
  MsgBox("Image Opened")
  image.Image = p
Else
  MsgBox("Image not located.")
End If

I’ve tried using the same code in a web app. For simplicity I commented out the line image.Image = p.

Running it in the IDE on the Mac works fine. When I build it, transfer it to The Pi is starts up fine and displays the page. However, as soon as a click the button which fires the code I get the following error:

./WebTestJpg: symbol lookup error: /home/pi/Xojo/SkyCamImages/WebTestJpg Libs/XojoConsoleFrameworkARM.so: undefined symbol: gdImageCreateFromJpeg

Have I forgotten to do something to make this work properly?

Ok, that seems to be where the error is occurring. I had my original app running as a Daemon and it was crashing without any error message that I could find. Perhaps I wasn’t looking in the right places. However, running it as a normal web app it crashes out with the message:

SkyCam/Linux ARM/SkyCam/SkyCam: symbol lookup error: /home/pi/Xojo/SkyCam/Linux ARM/SkyCam/SkyCam Libs/XojoConsoleFrameworkARM.so: undefined symbol: gdImageCreateFromJpeg

Any ideas what’s causing this to happen?

Can you post one of these jpegs do we can look at it?

Thanks Greg, you can find one here:

https://www.dropbox.com/s/7kd449w1m17g8us/test.jpg?dl=0

The fact that this image opens just fine in a console app on my mac means one of two things. Either it’s a bug in our framework or a limitation in the library that we use.

Just out of curiosity, what version of Xojo are you using?

Yeah, I found I could open it fine in on a Mac from both a desktop app and a web app. It also opened ok in a Raspberry Pi desktop app but it throws the undefined symbol error as a Raspberry Pi web app.

I’m using 2017r3 because the app crashes almost immediately if I build it with a later version. I’m not sure why that happens but I thought might be because the app also uses the gpio - although I haven’t proven that to be the cause.

Looking at Feedback, we updated the version of LibGD that we linked against in 2018r1 which should fix this jpg problem you are having. Maybe we should isolate why your app is crashing with newer versions instead.

I still think 208R2 has problems with web apps on the Raspberry Pi so I have generally avoided it.

For example, this simple web app, with just a button and a label, works fine if built under 2017R3 but if I build it with 2018R2 it just jumps to 100% cpu and any attempt to load the page just stalls in the browser.

https://www.dropbox.com/s/vd6ixlafxo1499o/SkyCam%20Test.zip?dl=0