GLBasic forum

Main forum => Bug Reports => Topic started by: bigsofty on 2010-Apr-14

Title: Load JPG on iPhone broken, when used with PNGs
Post by: bigsofty on 2010-Apr-14
Loading a jpeg, then loading a png, causes "EXC_BAD_ACCESS"

Code (glbasic) Select

SETCURRENTDIR("Media")
LOADSPRITE "test.jpg", GENSPRITE()
LOADSPRITE "movcarmtxt.png", GENSPRITE()// PNG's need to be 1st


I don't think the JPEG file type (bits, compression etc.) matters but I can supply the above files if need be.
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: MrTAToad on 2010-Apr-14
It does pretty much on other platforms too :)
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: Scott_AW on 2010-Apr-15
Don't use JPEGs, they're horrible and should be forgotten.
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: bigsofty on 2010-Apr-15
Its not a real situation, only coded to show the error.  ;)

I don't have to use JPEGs but Gernot needs to be aware of the error.
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: Kitty Hello on 2010-Apr-15
I am aware of that. The JPEG laoder is buggy and for iPhone even more.
I never wanted JPEG, just that you know. that's what I get for implementing features I don't really like :/ ;)
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: MrTAToad on 2010-Apr-19
Shame you cant get rid of it  :P
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: FutureCow on 2010-May-12
I've just encountered this bug too on a windows box (it does do a very nice program crash doesn't it?  :D ). It drove me nuts tracking it down as I could load a jpeg once and it would work, if I then loaded it again (under a different sprite number) it crashed. At least I know I can fix it by migrating everything to PNG (which is normally my format of choice anyway, I just inherited a lot of graphics in jpeg and used them as GLBasic supported them.)
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: bigsofty on 2010-May-12
I agree, it can be a horrible bug to find as the line causing the bug actually works fine, its another, relatively unrelated line that actually crashes...  :blink:

JPEG, is not a good format any-ways, maybe JPEG support should be pulled while this bug exists?
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: Ian Price on 2010-May-12
QuoteJPEG, is not a good format any-ways,
Which is why only 99.9%* of photographic devices produce this format as standard...

It is a necessay evil - it can be very useful in apps - especially since GLB supports iPhone, which itself uses the JPEG format. It is a relevant and very popular format that I think needs to be included and fixed. As developers we can choose not to use it; but if we do, it should work.




* approximate guesstimation ;)
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: Kitty Hello on 2010-May-13
Yes. I have the new jpeg lib here and will see if it can fit the old code.
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: Ian Price on 2010-May-13
:)
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: MrTAToad on 2010-May-13
Yey!  We can them mercilessly test it :)
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: bigsofty on 2010-May-13
Cool, thanks Gernot!  :good:

... I should have that made into my sig, save time typing!  :S
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: Scott_AW on 2010-May-14
Quote from: Ian Price on 2010-May-12
QuoteJPEG, is not a good format any-ways,
Which is why only 99.9%* of photographic devices produce this format as standard...

Bad habits die hard I guess.  I do photo toning and clip art for my job time to time, I've grown to loath JPEGs with a passion.
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: Ian Price on 2010-May-14
QuoteBad habits die hard I guess.  I do photo toning and clip art for my job time to time, I've grown to loath JPEGs with a passion.
Well, whether you like it or not, it's not going away anytime soon.

I do happen to agree though, especially now that we have huge amounts of storage space in something smaller than a fingernail. There is really no excuse for not offering alternative formats for saving images, but how many of todays devices do? I suspect maybe only the ones deemed for "professional" use.
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: doimus on 2010-May-14
Yes, most new cameras offer JPEG only. My old (2002) photo allowed TIFF, but today is either RAW or JPEG, with nothing in the middle.

I guess PNG is not used because of compressing algorithm that would use too much resources, but simple uncompressed lossless bitmaps in cheap cameras would be appreciated. But then again, most cheap cameras have crappy lenses, so image quality is awful even before it reaches digital sensor.
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: bigsofty on 2010-May-14
As JPEG is a lossy format, this is the reason I personally don't like it.

It is undeniably very popular, so it should be supported for that reason alone.

But for me, I use RAW on my camera for more consistent and high quality results, I use JPEG if I am low on space and don't care too much about the quality of the picture but want to save space on my media.
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: doimus on 2010-May-14
JPEG is ok on mobile phone cameras and such, especially when sending them over the mobile network, where file size is still important.

On my former job (casual games for PC) graphics for games were almost exclusively JPEG, sometimes even with bigger compression.
Casual players and portals are very sensitive to file size, so downloadable games have to be as small as possible but have all the eye candy. Since games are mostly 1024x768, just backgrounds for 30+ levels would use huge amounts of space if they werent JPEG.

OTOH, if you're making retro-remake/low-res pixel art game, it would be insane to use lossy image format.

It's just a matter of work strategy. Both lossy and lossless routes have sense in appropriate environment.
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: Scott_AW on 2010-May-15
I'm sure it has something either to do with legal stuff, or just PNG encoding takes more processing than JPEG.   Considering the bulk of the processing power is capturing the image, converting it to a PNG while capture might require more than what the standard digital camera is built with.

Either that or they're just using the same software from ten years ago...

Still, with large capacity cards, a professional photographer could use a few lessons in file formats and conversions to get the most out of their images.  JPEG artifacts are nasty things and RAW is big, but converting to a PNG on a PC isn't hard.  I believe even MS Paint can make a PNG.
Title: Re: Load JPG on iPhone broken, when used with PNGs
Post by: Ian Price on 2010-May-15
.PNG used to have licensing issues, but that hasn't been the case for quite some time now. Could be processing power, but honestly that kind of power is given away in cereal boxes nowadays (well it would be if they still gave stuff away in cereal boxes :()

Dunno. But the case still stands that for a variety of reasons JPEG is both good and bad.