How to set thumbnails as raw data?

This issue came up again in another recent discussion. I’m just putting a pointer here, in case someone else in the future comes along and doesn’t notice this (IMHO) very unexpected detail about AppleScript in this case.