I have, on my website, elements created by JS, and content set from a JSON file, in which there are images paths.
My problem is that sometimes, a few images load with a really bad quality (e.g: images). It's never all of them at the same time, like 2 out of 6 images, once out of 3 page loading.
Knowing that the images are not heavy at all (JPG's, 200 to 500 Ko each, for a total of 6 images that could increase in the future) is there anyway I could resolve the problem?
As advised by mplungjan in the comments, i've saved the image when it loads with bad quality, and it has the same size as the original, and has no problem once opened with windows photos.
Also, no errors or warnings appear in the console when it happens, or in the network section neither.
This happens on every browser tested with, and the website isn't online yet, only stored locally on my PC
Do you think this could be a solution? :
https://stackoverflow.com/a/31370466/14748679 - (load a smaller quality first and replace it by a better one after once it's ready?)
or could I set a funciton that checks the load quality and reloads only the images that have the problem?
When I reload the whole page, it becomes (and this pictures size is 193Ko) :
This is the code used to set the create the element and set the image source :
var profilphoto = document.createElement("img");
profilphoto.src = "C:\\Users\\Luc\\Desktop\\Projet\\Projet6\\FishEye_Photos\\Sample Photos\\PhotographersIDPhotos\\"+items.photographers[i].portrait;
profilphoto.setAttribute("aria-label", "Photographer's profil image");
profilphoto.classList.add('profilphoto');
photoandname.appendChild(profilphoto);