SerenityOS / serenity

The Serenity Operating System 🐞
https://serenityos.org
BSD 2-Clause "Simplified" License
30.42k stars 3.18k forks source link

Most jpg files don't open #4039

Closed danboid closed 1 year ago

danboid commented 3 years ago

I have got a few jpg files to load and display under serenity but the majority, about 90% of the jpeg files I have tried do not display as thumbnails in the file manager and nor do they display under QuickShow when I double click on them.

I have attached a couple of jpg's sourced from from a SM site you may have heard of that current don't open under Serenity:

124687763_2704432306464485_4772906715501244690_n 115850077_2607213792853004_6744027362703265399_n

devsh0 commented 3 years ago

The two JPEGs above seem to have SOF2 frames, which means they are progressively encoded. As of now the JPEG decoder cannot decode progressive JPEGs.

about 90% of the jpeg files I have tried do not display as thumbnails in the file manager and nor do they display under QuickShow

Have you been trying JPEGs from the same source? From what I know majority of images on the web are baseline JPEGs. This is one of the wallpaper sites that the Serenity browser can render and most JPEGs seem to load fine here: https://wallpaperscraft.com/

danboid commented 3 years ago

Thanks for explaining that @devsh0 . Did you write Serenity's jpg support? Do you plan to add prog jpg support?

devsh0 commented 3 years ago

Yes :)

Progressive JPEGs are tricky. There are multiple scans that incrementally refine the rendered image. I started working on it but lost motivation at some point. Also if I remember correctly, implementing progressive decoding would make the JPGLoader slightly incompatible with the Image decoder plugin, the generic interface that applications use to decode images. If you want, feel free to add progressive JPEG support.

danboid commented 3 years ago

I'm barely a beginner at programming and this is way over my head.

I'm still curious about how complete your progressive jpg code is? The image decoder plugin will have to be updated to accomodate progressive jpegs as its not a format that can be ignored in a desktop OS or browser.

devsh0 commented 3 years ago

Yes, eventually something has to be done about progressive JPEGs. I think we can make it work without tweaking the image decoder plugin if we finish all the scans before announcing "success" to the plugin, at which point it can proceed as if the image was a baseline JPEG. Earlier versions of internet explorer did exactly that. Of course, we then lose all the "benefits" of progressive rendering but I believe that's okay. There isn't much to gain by rendering images progressively.

That said, I don't think support for progressive JPEGs is an immediate requirement to the system. The only place where we should expect to see a lot of images is the browser and at this point, if you decide to browse the web seriously on Serenity Browser, unsupported progressive JPEGs will be the least of your annoyances ;-).

danboid commented 3 years ago

The progressive rendering was handy when I was on dialup 25 years ago but its not quite as essential when 100Mb connections are common. It would be nice to have but if you can get the prog jpgs to to display without the prog rendering that'd be a hack of legend sir!

We need to get @awesomekling running serenity full time ASAP and that's not gonna happen if he can't view his all-important meme stash.

danboid commented 1 year ago

Very nice!

This is Big News for Serenity so congrats on finally getting jpg loading sorted!

I have since built a Uzebox console, written a game and designed an open source hardware, mostly 3D printed arcade style stick for it.

uzebox.org