Chmod 20,000 files

I have a memory card in one of those slideshow picture frames with nearly 20,000 photos. I found that they were somehow read-only due to the file permissions.
I needed to chmod them but kept getting error until I did it like this:
find . -name ‘*.jpg’ -print0 | xargs -I{} -0 chmod 777 {}