JPEGBot is a Twitter bot I wrote that posts weird looking images to Twitter. It does this by searching Google Images for a semi-random word, downloading a random image from the results, and finally saving it as a JPEG 100 times, reducing the quality by one each time. The final result is the one that gets uploaded.

Example Images

Below you can see four images posted by the bot at some point and their transition from the original image found via Google and the final one. Scroll to the right to see each one. Note that these have been resized and saved again to reduce bandwidth.

Quality 100
Quality 99
Quality 98
Quality 97
Quality 96
Quality 95
Quality 94
Quality 93
Quality 92
Quality 91
Quality 90
Quality 89
Quality 88
Quality 87
Quality 86
Quality 85
Quality 84
Quality 83
Quality 82
Quality 81
Quality 80
Quality 79
Quality 78
Quality 77
Quality 76
Quality 75
Quality 74
Quality 73
Quality 72
Quality 71
Quality 70
Quality 69
Quality 68
Quality 67
Quality 66
Quality 65
Quality 64
Quality 63
Quality 62
Quality 61
Quality 60
Quality 59
Quality 58
Quality 57
Quality 56
Quality 55
Quality 54
Quality 53
Quality 52
Quality 51
Quality 50
Quality 49
Quality 48
Quality 47
Quality 46
Quality 45
Quality 44
Quality 43
Quality 42
Quality 41
Quality 40
Quality 39
Quality 38
Quality 37
Quality 36
Quality 35
Quality 34
Quality 33
Quality 32
Quality 31
Quality 30
Quality 29
Quality 28
Quality 27
Quality 26
Quality 25
Quality 24
Quality 23
Quality 22
Quality 21
Quality 20
Quality 19
Quality 18
Quality 17
Quality 16
Quality 15
Quality 14
Quality 13
Quality 12
Quality 11
Quality 10
Quality 9
Quality 8
Quality 7
Quality 6
Quality 5
Quality 4
Quality 3
Quality 2
Quality 1
Quality 0
Quality 100
Quality 99
Quality 98
Quality 97
Quality 96
Quality 95
Quality 94
Quality 93
Quality 92
Quality 91
Quality 90
Quality 89
Quality 88
Quality 87
Quality 86
Quality 85
Quality 84
Quality 83
Quality 82
Quality 81
Quality 80
Quality 79
Quality 78
Quality 77
Quality 76
Quality 75
Quality 74
Quality 73
Quality 72
Quality 71
Quality 70
Quality 69
Quality 68
Quality 67
Quality 66
Quality 65
Quality 64
Quality 63
Quality 62
Quality 61
Quality 60
Quality 59
Quality 58
Quality 57
Quality 56
Quality 55
Quality 54
Quality 53
Quality 52
Quality 51
Quality 50
Quality 49
Quality 48
Quality 47
Quality 46
Quality 45
Quality 44
Quality 43
Quality 42
Quality 41
Quality 40
Quality 39
Quality 38
Quality 37
Quality 36
Quality 35
Quality 34
Quality 33
Quality 32
Quality 31
Quality 30
Quality 29
Quality 28
Quality 27
Quality 26
Quality 25
Quality 24
Quality 23
Quality 22
Quality 21
Quality 20
Quality 19
Quality 18
Quality 17
Quality 16
Quality 15
Quality 14
Quality 13
Quality 12
Quality 11
Quality 10
Quality 9
Quality 8
Quality 7
Quality 6
Quality 5
Quality 4
Quality 3
Quality 2
Quality 1
Quality 0
Quality 100
Quality 99
Quality 98
Quality 97
Quality 96
Quality 95
Quality 94
Quality 93
Quality 92
Quality 91
Quality 90
Quality 89
Quality 88
Quality 87
Quality 86
Quality 85
Quality 84
Quality 83
Quality 82
Quality 81
Quality 80
Quality 79
Quality 78
Quality 77
Quality 76
Quality 75
Quality 74
Quality 73
Quality 72
Quality 71
Quality 70
Quality 69
Quality 68
Quality 67
Quality 66
Quality 65
Quality 64
Quality 63
Quality 62
Quality 61
Quality 60
Quality 59
Quality 58
Quality 57
Quality 56
Quality 55
Quality 54
Quality 53
Quality 52
Quality 51
Quality 50
Quality 49
Quality 48
Quality 47
Quality 46
Quality 45
Quality 44
Quality 43
Quality 42
Quality 41
Quality 40
Quality 39
Quality 38
Quality 37
Quality 36
Quality 35
Quality 34
Quality 33
Quality 32
Quality 31
Quality 30
Quality 29
Quality 28
Quality 27
Quality 26
Quality 25
Quality 24
Quality 23
Quality 22
Quality 21
Quality 20
Quality 19
Quality 18
Quality 17
Quality 16
Quality 15
Quality 14
Quality 13
Quality 12
Quality 11
Quality 10
Quality 9
Quality 8
Quality 7
Quality 6
Quality 5
Quality 4
Quality 3
Quality 2
Quality 1
Quality 0
Quality 100
Quality 99
Quality 98
Quality 97
Quality 96
Quality 95
Quality 94
Quality 93
Quality 92
Quality 91
Quality 90
Quality 89
Quality 88
Quality 87
Quality 86
Quality 85
Quality 84
Quality 83
Quality 82
Quality 81
Quality 80
Quality 79
Quality 78
Quality 77
Quality 76
Quality 75
Quality 74
Quality 73
Quality 72
Quality 71
Quality 70
Quality 69
Quality 68
Quality 67
Quality 66
Quality 65
Quality 64
Quality 63
Quality 62
Quality 61
Quality 60
Quality 59
Quality 58
Quality 57
Quality 56
Quality 55
Quality 54
Quality 53
Quality 52
Quality 51
Quality 50
Quality 49
Quality 48
Quality 47
Quality 46
Quality 45
Quality 44
Quality 43
Quality 42
Quality 41
Quality 40
Quality 39
Quality 38
Quality 37
Quality 36
Quality 35
Quality 34
Quality 33
Quality 32
Quality 31
Quality 30
Quality 29
Quality 28
Quality 27
Quality 26
Quality 25
Quality 24
Quality 23
Quality 22
Quality 21
Quality 20
Quality 19
Quality 18
Quality 17
Quality 16
Quality 15
Quality 14
Quality 13
Quality 12
Quality 11
Quality 10
Quality 9
Quality 8
Quality 7
Quality 6
Quality 5
Quality 4
Quality 3
Quality 2
Quality 1
Quality 0

About JPEG Bot

I got the idea after talking with someone about how JPEG files seem inexplicably worse at compressing the color red compared other colors. During our discussion they asked why that was, and at the time I actually didn't know.

JPEG is actually a lossy compression algorithm, not a file format. It sacrifices image quality for file size, reducing the amount of image data in order to save space. The algorithm takes advantage of how humans perceive color and brightness and ends up dropping sharp transitions in brightness and color, which our eyes are less sensitive to compared to more gradual changes. JPEG is great for continuous tone images (like photographs), but anything with solid, single-color areas in it will never work well as a JPEG.

The compression works the same for reds, blues and every other color, however it turns out the human eye is much better at seeing reds compared other visible colors. About 65% of our cone cells receive red light, so we notice changes in red fields more than those of other colors.

Since JPEG is a lossy file format, every time you re-save one you are actually losing some image data (the artifacts become part of the new image). This is taken to an extreme extent with JPEGBot, which saves an image 100 times, starting with the highest quality (100, of course) and reducing it for every subsequent save.

The final image ends up being really interesting looking and can vary wildly depending on the quality of the original image:

Semi-Random Word?

For selecting a search term I decided to use Darius Kazemi's Corpora project. The repository supplies, simply, "lists of things". I change which lists it pulls from every so often (whenever I think the results are getting boring) but currently it's pulling in from lists of minor planets, chemicals, room types, types of cannabis and the "computer sciences" list (which seems to mostly cause it to print technology stack logos). If you go back far enough in the bot's history you can see animals, locations, people doing their jobs and random household objects.

That's It

If you want to know any other stuff, feel free to say something to me on Twitter.