'How to compress a string consisting of only integers and two characters quickly?

I'm trying to implement custom images in Roblox

I'm using method of importing and applying the colors of each pixel, but if I don't compress it, the memory is too large. All the compression modules I have found so far are not suitable for in-game use due to the high delay.

Assuming that a string has only two distinct symbols (one for distinguishing r,g,b, and the other for distinguishing each RGB) and an integer of up to two digits(0~99), I wonder how best to optimize and compress it.

example color string

Original Color For Each Pixel
(255,125,55),(43,45,44),(0,0,0),(129,32,3)

After primary compression
99,49,21 17,17,17 0,0,0 50,12,1 <- Now I need to compress this


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source