2 Answers
2

Can I use the hats somewhere else, even for commercial use, or are they copyrighted?

No, you can't.

Being able to download a file does not necessarily give you the right to use it for your own purposes. You have to be able to download an image to view it; if that was the case, creators would lose all rights as soon as they uploaded a work to the internet.

Unless explicitly stated otherwise, Stack Exchange owns the copyright and reserves all rights not explicitly (or implicitly, in limited cases) granted to you. Quoting from the site's Terms of Service:

All materials displayed or performed on the public Network, including but not limited to text, graphics, logos, tools, photographs, images, illustrations, software or source code, audio and video, and animations (collectively "Network Content") (other than Network Content posted by individual "Subscriber Content") are the property of Stack Overflow and/or third parties and are protected by United States and international copyright laws ("Stack Overflow Content").

[...]

Other than as expressly set forth in these Public Network Terms, you may not copy, modify, publish, transmit, upload, participate in the transfer or sale of, reproduce (except as provided in this Agreement), create derivative works based on, distribute, perform, display, or in any way exploit any of the Network Content, software, materials, or Services in whole or in part.

To integrate what ArtofCode already said, Stack Exchange owns the copyright of the original hats images. So, it should be pretty clear that commercial reuse of those images is strictly forbidden.

That said, I would also notice that if you ask them nicely they may be fine if you reuse the picture for a fan project or anything not commercial. Back in 2015 a somehow similar question was asked on Meta Stack Overflow:

I really love the way my actual hat is improving my avatar. Would I be allowed to make a copy of that hat and edit it in my avatar after the event is over?

In that occasion, Jaydles replied:

Go nuts.

Technically, we own them, but you're free to use them as you see fit.

So, if you have something specific in mind, I would advise you to just contact them and ask if they will give you their blessing.

I actually tried once, when I planned to create a small userscript that would have allowed me to use the hats all year long... Sadly that project died out pretty soon due to technical difficulties at the time (mainly, couldn't find an host for the server side required logic), but I remember them telling me that if I wished to give that idea a go they wouldn't oppose it.

So, to recap:

DO NOT reuse the hats for commercial use, even if you plan to give proper attribution to the original source.DO ASK for permission if you plan to use them for a personal project.IF they give you permission, remember to thank them and give proper attribution.