We wrote a tool like this in my last job to guess the width of raw images like these. First, we were dealing with iOS, and there are certain constraints on the platform which help with guessing width (bitmaps are generally 32-bit BGRA, and the rows in iOS bitmap images are aligned to 32 bytes). Because of the alignment constraint you only have to guess the width in 8-pixel increments. Then pick the width that minimizes the average pixel difference between adjacent rows in the image. This usually guessed the width of the original image (or an integer multiple of the actual width), at least when the original image was a UI element (as UI elements generally have large rectangular blocks of color in them).