Upgrade to Pro — share decks privately, control downloads, hide ads and more …

FrOSCon 2015 - The JPEG is dead! Long live the JPEG!

FrOSCon 2015 - The JPEG is dead! Long live the JPEG!

A tour de force of major developments in open source image optimization.

A JPEG is a JPEG and nothing changed since 1992? Think again! Automated compression quality detection, advanced dithering algorithms, saliency mapping and computer vision - get a glimpse at what the image optimization open source community has been up to!

Tobias Baldauf

August 22, 2015
Tweet

More Decks by Tobias Baldauf

Other Decks in Technology

Transcript

  1. JPEG%is%dead!%Long%live%the%JPEG!
    Tobias%Baldauf%9%@tbaldauf
    #FrOSCon%2015
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 1

    View full-size slide

  2. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 2

    View full-size slide

  3. "We're&really&aiming&very,&very&high&
    here…&at&something&like&100&
    milliseconds."
    —&Urs$Hölzle,$Google$Senior$VP$Opera6ons,$June$2010
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 3

    View full-size slide

  4. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 4

    View full-size slide

  5. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 5

    View full-size slide

  6. WebP:
    PNG8+24+JPEG+GIF+be0er2compression
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 6

    View full-size slide

  7. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 7

    View full-size slide

  8. For$science!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 8

    View full-size slide

  9. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 9

    View full-size slide

  10. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 10

    View full-size slide

  11. 12.000x&WebP!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 11

    View full-size slide

  12. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 12

    View full-size slide

  13. WebP:&33%&sliced&off
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 13

    View full-size slide

  14. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 14

    View full-size slide

  15. JPEG%XR
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 15

    View full-size slide

  16. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 16

    View full-size slide

  17. "Good%psy[cho,visual]%op3miza3ons%
    are%more%important%than%anything%else%
    for%compression."
    —%Fiona&Glaser,&x264&encoder&developer,&September&2010
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 17

    View full-size slide

  18. Who$won$the$race?
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 18

    View full-size slide

  19. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 19

    View full-size slide

  20. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 20

    View full-size slide

  21. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 21

    View full-size slide

  22. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 22

    View full-size slide

  23. Hold%it%right%there!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 23

    View full-size slide

  24. Storage(space(is(cheap
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 24

    View full-size slide

  25. Bandwidth)is)cheap
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 25

    View full-size slide

  26. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 26

    View full-size slide

  27. So#why#should#we#care?
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 27

    View full-size slide

  28. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 28

    View full-size slide

  29. Because'it's'all
    about'the'users!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 29

    View full-size slide

  30. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 30

    View full-size slide

  31. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 31

    View full-size slide

  32. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 32

    View full-size slide

  33. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 33

    View full-size slide

  34. What%can%we%do%about%it?
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 34

    View full-size slide

  35. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 35

    View full-size slide

  36. The$king$is$dead!
    Long$live$the$king!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 36

    View full-size slide

  37. JPEG!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 37

    View full-size slide

  38. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 38

    View full-size slide

  39. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 39

    View full-size slide

  40. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 40

    View full-size slide

  41. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 41

    View full-size slide

  42. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 42

    View full-size slide

  43. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 43

    View full-size slide

  44. 16.7%million%colors
    24bit
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 44

    View full-size slide

  45. Already(fully(standardized(+(OSS(in(1992
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 45

    View full-size slide

  46. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 46

    View full-size slide

  47. JPEG%codec%for%bitstream%data
    +
    file%format%declara5on:JFIF%or%Exif
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 47

    View full-size slide

  48. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 48

    View full-size slide

  49. JPEG:
    built+based+on+human+visual+system
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 49

    View full-size slide

  50. Human&Vision:
    Brightness&=&+2
    Color&Differen9a9on&=&:1
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 50

    View full-size slide

  51. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 51

    View full-size slide

  52. DCT
    type%II
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 52

    View full-size slide

  53. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 53

    View full-size slide

  54. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 54

    View full-size slide

  55. There%is%no%quality%se0ng
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 55

    View full-size slide

  56. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 56

    View full-size slide

  57. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 57

    View full-size slide

  58. JPEG%encoders%are%opinionated%Rupe%Goldberg%machines
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 58

    View full-size slide

  59. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 59

    View full-size slide

  60. Remember&the&human&visual&system?
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 60

    View full-size slide

  61. Rods%&%Cones
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 61

    View full-size slide

  62. Cones&are&for&colors:
    long,&medium&&&short&wavelength&cone&types
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 62

    View full-size slide

  63. Long,&medium&&&short&cones
    have&a&ra4o&of&18:3:1
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 63

    View full-size slide

  64. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 64

    View full-size slide

  65. We#see#RED#in#more#detail.
    RED#means#"tasty,#ripe,#good#to#eat"
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 65

    View full-size slide

  66. Many%JPEG%encoders%are%less%lossy%for%RED
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 66

    View full-size slide

  67. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 67

    View full-size slide

  68. There%are%also%lossless%op+miza+ons%for%JPEGs
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 68

    View full-size slide

  69. jpegtran)&)jpegrescan
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 69

    View full-size slide

  70. Huffman'table'op.miza.on
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 70

    View full-size slide

  71. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 71

    View full-size slide

  72. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 72

    View full-size slide

  73. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 73

    View full-size slide

  74. mozjpeg
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 74

    View full-size slide

  75. Op#mized)Huffman)tables
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 75

    View full-size slide

  76. Custom'quan+za+on'matrices
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 76

    View full-size slide

  77. Trellis'quan,za,on
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 77

    View full-size slide

  78. Op#mized)progressive)encoding
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 78

    View full-size slide

  79. all#with#minimal#impact
    on#the#SSIM#score
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 79

    View full-size slide

  80. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 80

    View full-size slide

  81. SSIM?
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 81

    View full-size slide

  82. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 82

    View full-size slide

  83. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 83

    View full-size slide

  84. To#measure#dissimilarity:
    DSSIM
    h"ps:/
    /github.com/pornel/dssim
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 84

    View full-size slide

  85. Dissimilarity:
    0.13%
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 85

    View full-size slide

  86. ~1.5%&ok
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 86

    View full-size slide

  87. Automate!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 87

    View full-size slide

  88. cjpeg&dssim
    h,p:/
    /github.com/technopagan/
    cjpeg&dssim
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 88

    View full-size slide

  89. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 89

    View full-size slide

  90. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 90

    View full-size slide

  91. Adap%ve(JPEG(quality
    based(on
    Round(Trip(Times
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 91

    View full-size slide

  92. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 92

    View full-size slide

  93. Adept
    h"p:/
    /github.com/technopagan/adept3jpg3compressor
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 93

    View full-size slide

  94. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 94

    View full-size slide

  95. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 95

    View full-size slide

  96. MSSS
    h"p:/
    /github.com/technopagan/mss3saliency
    Maximum'Symmetric'Surround'Saliency'Algorithm
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 96

    View full-size slide

  97. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 97

    View full-size slide

  98. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 98

    View full-size slide

  99. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 99

    View full-size slide

  100. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 100

    View full-size slide

  101. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 101

    View full-size slide

  102. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 102

    View full-size slide

  103. There's'things'JPEG'just'can't'do...
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 103

    View full-size slide

  104. ..."not"yet,"anyway!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 104

    View full-size slide

  105. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 105

    View full-size slide

  106. JPEG%XT
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 106

    View full-size slide

  107. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 107

    View full-size slide

  108. jpeg%[email protected]%stu2gart.de
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 108

    View full-size slide

  109. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 109

    View full-size slide

  110. In#case#you#don't#have#the#0me
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 110

    View full-size slide

  111. No!$Not$PNG24!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 111

    View full-size slide

  112. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 112

    View full-size slide

  113. PNG8%can%do%alpha%transparency
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 113

    View full-size slide

  114. The$old$way:
    cat$infile.png$|$pngquant$256$>$tmp.png
    pngout'sta*c,'c3,'d8,'force,'y,tmp.png,tmp.png
    pngcrush)*bit*depth)8)*brute)*rem)alla)*reduce)tmp.png)output.png
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 114

    View full-size slide

  115. The$much,$much$be*er$way:
    h"p:/
    /github.com/pornel/pngquant
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 115

    View full-size slide

  116. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 116

    View full-size slide

  117. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 117

    View full-size slide

  118. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 118

    View full-size slide

  119. h"p:/
    /quasimondo.com/ZorroSVG/
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 119

    View full-size slide

  120. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 120

    View full-size slide

  121. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 121

    View full-size slide

  122. SVG$can$be$op,mized,$too!
    h"p:/
    /github.com/svg/svgo
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 122

    View full-size slide

  123. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 123

    View full-size slide

  124. At#some#point
    things#don't#become#lighter#anymore
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 124

    View full-size slide

  125. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 125

    View full-size slide

  126. LQIP
    h"p:/
    /www.guypo.com/introducing3lqip3low3quality3image3placeholders/
    h"p:/
    /code.facebook.com/posts/991252547593574/the9technology9behind9preview9photos/
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 126

    View full-size slide

  127. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 127

    View full-size slide

  128. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 128

    View full-size slide

  129. WebP
    OSS:$!
    Worth&shipping:&!
    Worth&helping:&!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 129

    View full-size slide

  130. JPEG%XR
    OSS:$✋
    Worth&shipping:&!
    Worth&helping:&!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 130

    View full-size slide

  131. (D)SSIM
    OSS:$!
    Worth&shipping:&❌
    Worth&helping:&!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 131

    View full-size slide

  132. MSSS
    OSS:$!
    Worth&shipping:&❌
    Worth&helping:&!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 132

    View full-size slide

  133. pngquant
    OSS:$!
    Worth&shipping:&!
    Worth&helping:&!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 133

    View full-size slide

  134. svgo
    OSS:$!
    Worth&shipping:&!
    Worth&helping:&!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 134

    View full-size slide

  135. JPEG%XT
    OSS:$!
    Worth&shipping:&!
    Worth&helping:&!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 135

    View full-size slide

  136. mozjpeg
    OSS:$!
    Worth&shipping:&!
    Worth&helping:&!
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 136

    View full-size slide

  137. Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 137

    View full-size slide

  138. Tobias'Baldauf
    @tbaldauf
    who.tobias.is
    Tobias'Baldauf'-'@tbaldauf'-'who.tobias.is 138

    View full-size slide