Yes, you can use a library like GD or ImageMagick.
But , why don't you continue with CSS? You can save the play button separately for ease of maintenance, use JPEG for thumbnails (the play buttons usually do not look very good when encoding as JPEG).
, ( API ).