New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix broken png files: libpng 1.6.2 and newer has stricter iCCP rules #2216
Conversation
Thanks for your contribution. Before merging, I need to verify that this does not introduce problems with older libpng versions, as you mentioned :-) |
I'll can try to test it on my system with different versions of libpng. What I will not be able to test is how this might affect the Windows and Mac environments. I would expect no problems since strictly speaking the png files should be cleaner at this stage compared to before. But I agree, better safe then sorry :-) |
Yes, please do. I'll do my part on Mac and Windows |
Not an expert here, so not entirely sure, but I can't see how testing with older libpng versions (1.5 for instance) is relevant. The newer versions have stricter checks on testing if a png is compliant with the standard. Version 1.6 has more strict tests, so warns when files are not 100% according to the standard. I assume that this stricter checking would actually benefit older clients rather than the contrary. Again assuming here, but I would but very surprised indeed if png's created with libpng 1.6 would not be backwards compatible with older viewers. Further, I am not even sure if libpng is actually used when they are rendered/shown in Spyder. I am under the impression it libpng comes into the picture when manipulating png's. See for instance Wikipedia for what libpng is supposed to do. That being said, I am not sure testing for me is worth the trouble: I would have to recompile Qt using an older libpng version in order to test this. I think it would be sufficient for any other user with a libpng version prior to 1.6 (being 1.5, 1.4, ...) to see if these png images still work:
That sounds like much simpler testing path :-) |
While you're modifying the icons, could you try to use optipng on them ? it optimizes them without losing any information, I've used this program successfully many times. |
@Nodd, interesting suggestion, and I gave it a spin. For most PNG's, using:
resulted in a 30% decrease in size. I have not compared all the results visually one on one, but a visual inspection of a running Spyder instance looks fine for me. Additionally, used Github's Image view modes to compare some of them head on, and couldn't see any difference at all. @Nodd: while you are also at it, just in case you have an libpng version prior to 1.6, can you confirm these png's still all work properly? |
These optimized png's consume approximately 1MB less of my disk space. I don't know if this has any effect, but at least there leaner now :-) |
I'll try tomorrow, we have some old hardware at work ! |
@davidovitch , @Nodd any progress on this one? |
@goanpeca Not from my part. I think some more images have been added and I still have to add them. I hope to get back to this later this week or next week. |
If this is something that we would like to do periodically to keep images in spyder clean, then maybe it would be nice to have such script inside the repo. |
That would makes sense. I am not sure who generates the images on what platform and with which versions. I have now used ImageMagick for the conversion on Linux. I will have to look into how to avoid this issue in the future (which will depend on what software is used on which platform). Maybe I create a unit test case that all images should be able to pass. |
I have problems cloning the repo on the machine I was talking about. I'm in favor of merging it because imagemagick is a well-know and stable program and I don't see any reason why the new png images would cause any problem. They are displayed fine in github for example ! The script should go to https://github.com/spyder-ide/spyder/tree/master/img_src |
@davidovitch, please add your script to the location mentioned by @Nodd. Then I'll merge :-) |
@davidovitch, any updates ? Just a small script ! |
@Nodd, sorry for the delays. I've named it |
Linux only is fine, thanks. |
You should run from the top level spyder repository directory in order to be sure to catch all png files. Since it will recursively run through all the sub directories, this might cause some unwanted side effects if you run it by accident from, for instance, your home directory. I think it is fair to assume the developer knows what he/she is doing. I am not sure how to always browse to the top level spyder directory. Could you explain what you mean with |
|
Ah ok, I still have to learn a lot of the regular bash magic :-) Thanks for explaining. |
@ccordoba12 I think this is about to be ready for merge. Do you want me to clean up and rebase + squash into fewer commits? Any more comments/suggestions? |
Does this conflict with #2260 ? If not, we should merge it. |
Yes, it should conflict with the last commit of #2260. |
…th png file standards, and optimize png withouth loss of quality
rebased on upstream/master, there was one merge conflict, and I adopted upstream version (deleted image). Let me know if you want this squashed into 2 commits: one for the re-formatted images, and one for the utility conversion script. |
@davidovitch, thanks for the fix. Now that Anaconda has moved to libpng 1.6 we also need this fix in the stable branch. |
Fix broken png files: libpng 1.6.2 and newer has stricter iCCP rules
I am running on Arch Linux with libpng 1.6.16, and for a long time I have had the following error being spit out to the shell when running spyder from the command line:
I never bothered to look into it, spyder just worked fine, until I wanted to figure it out today. Seems this is related broken *.png files used by spyder. The fix is trivial, and I found the same answer both at stackoverflow and tex.stackexchange:
The libpng warning dissapeared after the *.png file conversion for me. I have not tested these new *.png files with libpng versions prior to 1.6.2 (the version that is alleged to have stricter iCCP checkings).