Here's an encoding for Piet programs
I've published an encoding (with a translator program) that represents a Piet program as a series of ASCII characters. It encodes each codel as one character, and therefore:
We can now count Piet programs by codels
There are 20 different colors of codels, so each color can be encoded in five bits. I've used the sixth bit of each character as a flag to indicate end-of-line, meaning that the size of the image doesn't need to be encoded separately. So any Piet program with N codels can be encoded as an N-byte text file. Since we count code by the number of bytes in the file, this means Piet can officially be counted by codels.
... Although some programs can be encoded in fewer bytes
Since end-of-line is specified for each line separately, it is possible to have uneven lines. The translator right-pads shorter lines to the length of the longest line using black codels. Therefore, black codels at the ends of lines can be omitted in the encoding. For example, this program has 18 codels, and it can be ASCII-encoded in 18 bytes:
However, since the two black codels are at the end of a line, they can also be omitted, resulting in a 16-byte ASCII version:
It is up to the golfer whether they want to take advantage of this feature. It's always possible to score your program in codels, since there is always an ASCII representation with the claimed bytecount. If you want to take advantage of the black codel omission, I would suggest reporting both the number of codels and the number of bytes (and perhaps linking to the encoding as well).
Number of bytes in the image file
We should stop making up new scoring schemes for programming languages, which only serves to make things more difficult. Code golf contests are scored in bytes, so that's what matters. Everything else is artifical and prone to not take all details into account.
For example, scoring Piet submissions just by the number of codels doesn't take the shape into account; it considers 4x1, 2x2, and 1x4 images with the same codels the same program, which obviously isn't true.