GLBasic forum

Main forum => Bug Reports => Topic started by: Qedo on 2021-Jun-30

Title: GLBasic Version 16.793 (Steam) does not load the jpg file and some png (confirm)
Post by: Qedo on 2021-Jun-30
GLBasic Version 16.793 (Steam) does not load the jpg file and some png (probably large dimensions).
Verified on two computers (Win10).
Gernot could you verify?
Thank you

ad maiora
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png
Post by: Kitty Hello on 2021-Jul-01
can you zip me a tiny project?
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png
Post by: Qedo on 2021-Jul-01
Thank you.
Code: (glbasic) [Select]
// --------------------------------- //
// Project: loadspritejpg
// Start: Wednesday, June 30, 2021
// IDE Version: 16.793
SETCURRENTDIR("Media") // go to media files
SETFONT 0,2
file$="any_jpeg_file_and_some_png.jpg"
IF DOESFILEEXIST(file$)
ok% = LOADSPRITEMEM(file$, w%, h%, pixRGBA%[])
LOADSPRITE file$,0
GETSPRITESIZE 0,sx,sy // return sx=0 and sy=0
DRAWSPRITE 0,0,0 // don't show the sprite
PRINT sx+" "+sy,0,0 // wrong dimensions=0
SHOWSCREEN
MOUSEWAIT
ELSE
PRINT "the file "+file$+" don't exist",0,0
SHOWSCREEN
MOUSEWAIT
ENDIF
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png
Post by: Kitty Hello on 2021-Jul-05
Good find. It was a signed/unsigned error checking the first bytes of the file. I'll prepare an update.
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png
Post by: Qedo on 2021-Jul-10
Gernot,
waiting for the update I am using version 16.720 and I have noticed that it crashes when I load (LOADSPRITE) large png files.
In my case the file is 3701x2387 pixels. With 15.238 version no problem
I do not know if this problem will be present in the future version but in any case I report it for your verification.
Thank you
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png
Post by: Qedo on 2021-Jul-10
Update:
I did further tests and it is not the size of the images that cause the program to crash because I loaded even bigger png without problem.
Only the attached image (designed by me )  crash the program . I don't understand why with normal graphics programs (GIMP) I display it correctly.
You can check?
Thank you
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png
Post by: spacefractal on 2021-Jul-11
There was a jpg issue in Greedy Mouse as well as a jpg indeeded did crash as well in one of the newer update, but here its was just a very small floor image that caused the crash. im ended here to just convert the to png and then its worked again, its was no big deal for me.

So im will confirm the issue as there is some jpg issues here. A issue im do cant fix here, up to Gernot.

Anyway im got you possible to revert to the lastet 2020 version on steam until then or convert them to png. Size is no biggie today at all.
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png
Post by: Qedo on 2021-Jul-11
spacefractal thank you
In my case the problem is on the png file (which I have attached) and not on an ipg, and then the program I am writing must allow in real time to be able to load either jpg or png indifferently and therefore I cannot previously do any type of conversion.

Ad maiora
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png
Post by: Qedo on 2021-Jul-11
Sorry maybe I added confusion with the last post.
To clarify the problems I encountered are two and the situation is the following:
1) vers. 16,793 (currently the latest steam version)
      It does not load all the Jpg files and some Png files
2) vers. 16,720
      Do not load the attached nihli.jpg file (and maybe someone else )

Thank you

Ad maiora
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png
Post by: spacefractal on 2021-Jul-11
this is odd. Its seens its a color either the jpg or png format does not like under decompress or under copying, while its does load the same image pretty fine from the bmp format.

So its not a size or memory issue for sure (as its should fails on the bmp file).

Im is not sure what its happens, but must been some how a decompress error or a round error. im not sure. But im confirm.

Here is the project im tested it with and its failed on both the 2020 and the newest version, so its not a issue created recently:
https://www.dropbox.com/s/loppc80q85gmlcp/imageloaderror.zip?dl=0

PS. Im on purpose cropped it a bit for testing. If im blankout the size with one color, its load fine, so its not a size issue.

PPS. Also on some machines textures over 2k might crash on some devices, but not the case here.
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png (confirm)
Post by: Kitty Hello on 2021-Jul-12
Get the beta branch: I fixed it, didn't I?
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png (confirm)
Post by: Qedo on 2021-Jul-12
unfortunately with GLBasic IDE, Version: 16.947 is not fixed
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png (confirm)
Post by: Qedo on 2021-Jul-12
Code: (glbasic) [Select]
unfortunately with GLBasic IDE, Version: 16.947 is not fixed
Or better now version 16.947 loads the png and jpg but not "nihil.png" that I have attached previously.
However it's a minor problem because I think something is wrong with that file.
Now I think it's okay.
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png (confirm)
Post by: erico on 2021-Jul-13
Could it be the level of compression on the PNG?
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png (confirm)
Post by: Qedo on 2021-Jul-13
GLB beta 16.947 correctly loads compression level 2-3-4-7-8-9 saved with Gimp
Title: Re: GLBasic Version 16.793 (Steam) does not load the jpg file and some png (confirm)
Post by: spacefractal on 2021-Jul-14
im did not check with the beta version throught. For me its could been a compression issue as its quite odd and also its failed with the jpg as well for the test project im attacehment to the dropbox (as its was too big). But im havent checked with the beta.

Here im saved the file from a very old paint shop pro 7 app (yes, that about 20 years old tool) saved to jpg, png and bmp. only bmp works correctly here, but Windows picture viewer does load them file.

As im have recently reinstalled Windows, im have still yet to test gimp as its could been a compresssion issue.

Look like its more a libpng bug as we does not uses the newest one, but its should not happens with a file saved by a 20 years old tool as im tested here?