Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

There is a particular icon library that I really like from DeviantArt.

Now, I have downloaded the package that has the png files inside (I know the ico files are there, but I want the png files).

However, about my Windows 7 computer tells me that about 1/3 of the png files are corrupt. I usually use XnView to view the files, and it won't display the "corrupt" files. I've tried other editors and viewers and I get the same issue.

Now, the png package was originally designed for Linux to be an OS-icon-package for the entire system, so I figure the png files were built in Linux.

So, is there a way I can "fix" the "corrupted" png files for my Windows 7 computer? Maybe when the files were created there was some bit that was off-colour or something?

Any clues?

[edit]

I have read in this thread that the "corruption" could happen during the extraction process. I did all the extraction with 7-zip. It was a zip containing a tar. I will try another extractor, but I don't think it will make any difference.

I think the answer might revolve around editing one of the beginning or ending bits in the binary file, but I'm not sure.

[update]

Okay, I fixed the link to the icon package... (the other one was fine) - but this new link is actually for the original package from DeviantArt.

I am going about it this way: I extract the contents of the .zip folder and then extract the contents of the .tar folder until nothing is compressed.

By way of an example, if you download that set, there is a file called add.png in the 32x32\actions folder. Another one is the 32x32\actions\bottom.png. There are a lot in all the folders. An example of a good one would be the 32x32\actions\appointment.png which is perfectly readable.

share|improve this question
    
I'd like to ask for some clarification. I'm not seeing any tar files in any of the offered downloads, only straight zips. Secondly, could you give an example of one or a couple of files that appear as corrupted to you? –  nitro2k01 Nov 10 '13 at 6:50
    
Sorry, nitro, I just realized I posted the wrong link. The one you downloaded I was able to extract just fine. My problem was with the original from the icon-maker, which has the different sizes in separate folders. As for an example, I'm not sure how to share an example - the "broken" images won't display in any of my image browsers. I posted a sample filename in my question. –  BGM Nov 10 '13 at 16:11
    
So, please try the link again - I fixed it. –  BGM Nov 10 '13 at 16:19
1  
To clarify something in addition to my answer, there's no such thing as a Linux-optimized PNG file. PNG is a standard format that is the same regardless of an operating system. This is just a file system issue, and has nothing to do with the PNG standard per-se. –  ADTC Nov 10 '13 at 18:56
    
You are right on that count - thanks for mentioning it. +1 –  BGM Nov 10 '13 at 20:14

2 Answers 2

up vote 3 down vote accepted

It appears that the problem is that the tar archive contains symbolic links. This means that duplicate files are not written twice but instead linked to an existing file. This can be done for example with the ln -s command in Linux, and if you then create a tar archive in Linux, the symlink would be stored in the tar archive.

However, 7-zip barfs on symbolic links in a tar archive, and instead of handling it cleanly, such as making an identical copy of the linked file, it writes the linked file name as the content of the file. In this case, the file gnome-panel-launcher.png contains the actual image.

7zip tar symlink bug

You don't really have much choice except for reporting this is a bug (but there's already a bunch of existing cases in their bug tracker and no sign of any progress) or finding an archiver which can better handle the situation. I tried WinRAR, which is what I normally use, and it could extract the archive without problem.

share|improve this answer
    
Wow, nice answer! Thank you. –  BGM Nov 10 '13 at 20:13
    
I tried extracting with winrar, and it did a better job, but the "symbolic" images had transparency issues. So I just went through and deleted the duplicates. –  BGM Nov 10 '13 at 20:26
    
The actual contents of a symbolic link file is the filename of the target file, and tar would be storing that too. I guess 7-zip simply fails to recognise that the file is a symblic link and treats it as a plain file. –  Adrian Pronk Nov 15 '13 at 9:48

I have tried extracting the Tar archive in 7-Zip. There really is no problem with the extraction process. The problem is that Tar archives can have symbolic links in a Linux system, and these links are extracted as files in Windows by 7-Zip.

Since you only need the actual images, you can safely delete these symbolic link files that appear as invalid PNG files and just use the remaining actual images. The symbolic link files are about the size of 8 to 32 bytes, I notice, whereas actual images are bound to be much bigger, at least more than 320 bytes.

But if you want to know what actual file each symbolic link links to, you can open the link file in Notepad or a text editor (yes, eventhough it's a .PNG file) and you will find the file name of the actual file. For example, the symbolic link file add.png when opened in Notepad reveals that the actual file is list-add.png. You can find that this file exists in the folder and contains the add icon.

enter image description here

You can rename the symbolic link files from .PNG to .TXT for easy look-ups. But I would simply delete them away since I'd only be interested in actual images, and there's no need to have copies of the same image (even if Windows provides a symbolic or hard linking system of its own).

Note: During the extraction process, you maybe asked whether to overwrite certain files. Answer Yes when you know the existing file is about 12 bytes and the new file is something like 500-1,000 bytes or more. The existing file is a symbolic link file whereas the new file overwriting it is the actual image.

share|improve this answer
1  
Wow, thanks! What a nice answer. I wish I could accept them both. –  BGM Nov 10 '13 at 20:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.