To be protected under copyright law and from AI do I need to pay or contact anyone? Or can I just use these codes as a warning and not have to pay for protection in advance?

I’m just not sure if using these will actually protect my work or is just an “all bark, no bite” type of ordeal

I, of course, cannot give legal advice! Best practice in most cases is to file for a copyright on your work, in the instances where it makes sense (assuming you live in the USA), OR become familiar with the process of takedown requests through the DMCA, or Digital Millennium Copyright Act (also assuming you live in the USA). I have done some research on these as an artist, but I am not an authority on the matter. Copyrighting every work I make is not feasible for me as a small artist due to the fees, but I would copyright an artist's book, for example.

The AI protection here is less USA specific - it refers to the Glaze & Nightshade projects, linked in the code itself. Usage of these free programs - developed by researchers in UC - obscures the artist's style and poisons the overall AI database when added, respectively. (NOTE: it's possible that any pixel-crunching file compression may negatively impact the efficacy of Glaze/Nightshade, since they have to do with visual artifacts, but again: I am not an authority, only a curious bystander.)

If you're curious about the above points, I encourage you to research them yourself! Unfortunately, digital theft is as hard to prevent as it is to trace (ha!) back to its source. In most cases, a combination of the code, artist watermarks, compressed images, and and application of Glaze/Nightshade, and you've deterred the majority of potential thieves by virtue of making it difficult to steal. Going by my personal observations, most digital thieves steal either because they are ignorant or lazy, and they find it easy to go after the "low-hanging fruit." 

TL;DR - no definitive YES or NO. Internet rights are a complex issue, and the more you know the more prepared you'll be!

Thank you! I will definitely look more into it! This has been really helpful tho 🙏🙏

Happy to share what I know - and best of luck with your research!

This is super smart. I'd love something like this for my page. 

There's a lot of tutorials about coding on the forums, including this one, if you're having trouble making the code work!