Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
実例で学ぶ画像最適化集 with ImageFlux / ImageFlux meetup#2
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Tatsuhiko Kubo
September 25, 2018
Technology
20k
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
実例で学ぶ画像最適化集 with ImageFlux / ImageFlux meetup#2
Tatsuhiko Kubo
September 25, 2018
More Decks by Tatsuhiko Kubo
See All by Tatsuhiko Kubo
Mackerel in さくらのクラウド
cubicdaiya
1
1k
Handling a tremendous amount of images with Fastly / Yamagoya Traverse 2020
cubicdaiya
2
1.6k
System Integration with Fastly
cubicdaiya
0
680
Software Engineer, Infrastructure
cubicdaiya
4
3.3k
High Performance Count Up!
cubicdaiya
0
430
ImageFluxを利用した画像配信の最適化 / ImageFlux meetup 201801
cubicdaiya
0
3.2k
Building high performance push notification server in Go
cubicdaiya
5
3.4k
メルカリのデータ分析基盤 / mercari data analysis infrastructure
cubicdaiya
11
12k
On-call Engineering
cubicdaiya
8
6.9k
Other Decks in Technology
See All in Technology
[DroidKaigi 2026] Making UI specifications visible: Android UI development in the AI agent era supported by Compose Screenshot Testing and galleries
syarihu
0
550
データエンジニアリングワークショップ:Auto LoaderとSparkで学ぶデータパイプライン構築
databricksjapan
PRO
0
150
AndroidでHDRメディアを「壊さずに」扱う
chigichan24
0
380
AI時代におけるプロダクト横断勉強会の設計
zozotech
PRO
0
150
【視聴者参加型!】AWSセキュリティアンチパターンクイズ
syoshie
0
340
AIエージェントを雇う前に決める5つのこと
knishioka
1
150
Hub & Spoke 環境のネットワークルーティングを分解してみる
tsuyataku
1
520
Azure Cost Management の FOCUS コストデータを迷わず読むための“3つの軸”
tetsuyaooooo
0
140
Bet AI Day 2026丨AIを「使う」から、AIが「働く」へ ― LayerXが進める「組織AI」の社会実装
layerx
PRO
2
2.1k
Guerilla InnerSource in enterprises, during the AI hype
onenashev
PRO
0
150
DMMブックスのNext.js化を加速させるAI活用 / Migrating DMM Books to Next.js with AI
kentarom
1
330
「重なり」は迎える側がつくる ― 人もAIエージェントも歓迎するプロダクトエンジニアリング ―
go0517go
PRO
0
220
Featured
See All Featured
It's Worth the Effort
3n
188
29k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
680
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Bash Introduction
62gerente
615
220k
Into the Great Unknown - MozCon
thekraken
41
2.7k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
300
Side Projects
sachag
455
43k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Why Our Code Smells
bkeepers
PRO
340
58k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Tell your own story through comics
letsgokoyo
1
1.1k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Transcript
Tatsuhiko Kubo@cubicdaiya ImageFlux meetup #2 2018/09/25 ࣮ྫͰֶͿը૾࠷దԽू with ImageFlux
@cubicdaiya / Tatsuhiko Kubo Principal Engineer, SRE @ Mercari, Inc.
imageflux-cli • ImageFluxͷAPIΫϥΠΞϯτ • github.com/mercari/imageflux-cli • $ imageflux-cli Usage: imageflux-cli
cache.lookup -k $url # lookup cache by key imageflux-cli cache.delete -k $url # delete cache by key imageflux-cli signature -s $secret -p $path # calculate signature of signed url
None
ϝϧΧϦʹ͍ͭͯ • ຊ࠷େͷϑϦϚΞϓϦ • 3Ͱ؆୯ʹग़ • 1) ࣸਅΛࡱΔ • 2)
ใΛهೖ • 3) ग़ϘλϯΛԡ͢ • ҆৺҆શͳܾࡁɾऔҾ • ΤεΫϩʔ • ಗ໊ૹ
ྦྷܭग़ͷਪҠ
ϝϧΧϦʹ͓͚Δը૾৴ • ϝϧΧϦͷσʔλ௨৴ྔͷେ෦ΛΊΔͷը૾ • ը૾ • ϓϩϑΟʔϧը૾ • όφʔը૾ •
etc…
ϝϧΧϦʹ͓͚Δը૾৴ • ը૾ͷྔ͕ͱʹ͔͘ଟ͍ • ຖը૾σʔλ͕ඦສݸ୯ҐͰ૿͑Δ • ଟ͘ͷػೳ໘Ͱը૾͕ओͳͷͰը૾σʔλͷ৴ྔ͕ͱͯଟ͍ • λΠϜϥΠϯɺݕࡧɺৄࡉ •
͍͍ͶʂҰཡɺӾཡཤྺ • etc…
ϝϧΧϦʹ͓͚Δը૾৴ • CDN • Akamai • ImageFlux • Fastly •
Origin • Amazon S3 ©2011 Amazon Web Services LLC or its affiliates. All rights reserved. User Users Client Multimedia Corporate data center Traditional server Mobile Client Internet AWS Management Console IAM Add-on Example: IAM Add-on Amazon Mechanical Turk On-Demand Workforce Human Intelligence Tasks (HIT) Assignment/ Task Requester Workers Amazon Mechanical Turk Non-Service Specific ©2011 Amazon Web Services LLC or its affiliates. All rights reserved. User Users Client Multimedia Corporate data center Traditional server Mobile Client Internet AWS Management Console IAM Add-on Example: IAM Add-on Amazon Mechanical Turk On-Demand Workforce Human Intelligence Tasks (HIT) Assignment/ Task Requester Workers Amazon Mechanical Turk Non-Service Specific User Users Client Multimedia Corporate data center Traditional server Mobile Client Amazon Mechanical Turk On-Demand Workforce Human Intelligence Tasks (HIT) Assignment/ Task Requester Workers Amazon Mechanical Turk Non-Service Specific User Users Client Multimedia Corporate data center Traditional server Mobile Client Internet AWS Management Console IAM Add-on Example: IAM Add-on Amazon Mechanical Turk On-Demand Workforce Human Intelligence Tasks (HIT) Assignment/ Task Requester Workers Amazon Mechanical Turk Non-Service Specific ©2011 Amazon Web Services LLC or its affiliates. All rights reserved. User Users Client Multimedia Corporate data center Traditional server Mobile Client Internet AWS Management Console IAM Add-on Example: IAM Add-on Human Intelligence Tasks (HIT) Assignment/ Task Requester Workers Amazon Mechanical Turk Non-Service Specific
ImageFlux࠾༻ͷഎܠ • ʑ૿͑ଓ͚ΔCDNͷը૾৴σʔλྔ • ৴ίετͷ૿Ճ • ΞϓϦͷσʔλ௨৴ྔͷ૿Ճ • ΞϓϦͷಈ࡞UXʹӨڹ •
UIσβΠϯมߋʹ͏࠷దͳը૾αΠζͷมԽ • σʔλ͕ଟ͍ͷͰෳύλʔϯͷը૾Λࣄલʹ४උ͢Δͷࠔ
ΞϓϦ͕շదʹ͑ΔΑ͏ʹͳΔͨΊʹ • σʔλͷ௨৴ྔΛ͑Δ͕ඞཁ • ͳωοτϫʔΫͰετϨεͳ͘ಈ࡞ • ߴͳಈ࡞͕ඞཁෆՄܽ • ͲΜͳʹૉΒ͍͠UIͰಈ࡞͕ա͗ΔͷUXͱͯͩ͠Ί
ImageFluxͷ࠾༻ͰظͰ͖Δ͜ͱ • ը૾ͷಈతͳϦαΠζɺ࠷దԽʹΑΔ • ৴σʔλྔͷݮ • ΞϓϦͷσʔλ௨৴ྔͷݮ • UIσβΠϯʹ͋ͬͨ࠷దͳը૾αΠζͷ࠾༻
ImageFluxʹΑΔը૾࠷దԽ • ϝϧΧϦͰ৴͞ΕΔը૾ΛΦϯβϑϥΠͰϦαΠζ & WebPʹม • ΦϦδϯ্ʹΦϒδΣΫτۃྗ૿͞ͳ͍ • ύϑΥʔϚϯεతͳ •
ωοτϫʔΫϨΠςϯγ >>>>> ը૾ͷมॲཧʹ͔͔ΔΦʔόʔϔου • ίετతͳ • ωοτϫʔΫϦιʔε >>>>>>(ӽ͑ΒΕͳ͍น)>>>>>>CPUϦιʔε
εϚʔτϑΥϯΞϓϦͰWebPը૾Λ৴͢Δ • iOS • ΞϓϦଆͰରԠ͕ඞཁ • WebviewෆՄ • Android •
OSωΠςΟϒͰରԠʢ4.0+ʣ • WebviewՄ
࣮ྫͰֶͿը૾࠷దԽू with ImageFlux
UIͷมԽʹରԠʢ2ྻλΠϜϥΠϯ -> 3ྻλΠϜϥΠϯʣ
2ྻλΠϜϥΠϯ͔Β3ྻλΠϜϥΠϯ • ظؒͷA/Bςετͷʹସ • ҰʹදࣔͰ͖Δը૾ͷ͕૿͑Δ • CDNͷτϥϑΟοΫ͕1.5ഒʹͳͬͨ • ίετ͕(ry •
ΞϓϦͷ௨৴ྔ૿Ճ • ΪΨ͕ݮΔ
3ྻ༻ͷαΠζʹϦαΠζ & WebPԽ 296x296 15.1KB 240x240 7.2KB w=240,f=webp 2ྻ༻ 3ྻ༻
296x296 15.1KB 240x240 12.5KB w=240 2ྻ༻ 3ྻ༻
1αϜωΠϧ͋ͨΓͷαΠζݮޮՌ • ϦαΠζ • 10~20%ݮ • ϦαΠζ & WebPԽ •
40~50%ݮ • λΠϜϥΠϯݕࡧ݁ՌͰը૾αϜωΠϧ͕େྔʹදࣔ͞ΕΔͷͰޮՌେ
ϝϧΧϦετΞ
ϝϧΧϦετΞ ϝϧΧϦͷΞϓϦͰ ࠝแࡐͷΦϦδφϧάοζ ͕ߪೖͰ͖Δػೳ
ϝϧΧϦετΞͷը૾৴ • ը૾ͷࣗମগͳ͍ • े • λΠϜϥΠϯͷҰ෦ͳͷͰϦΫΤετ͕ଟ͍ • ը૾αΠζ͕େ͖͍ͱ௨৴ྔ͕ΕΔ
ϝϧΧϦετΞʢλΠϜϥΠϯʣ
ϝϧΧϦετΞʢλΠϜϥΠϯʣ ࣮1ը૾͋ͨΓ 140KB͋ͬͨ (720x720)
ϝϧΧϦετΞʢৄࡉʣ
ϝϧΧϦετΞʢৄࡉʣ ͜ΕݪੇେͰදࣔ
ϝϧΧϦετΞͷը૾৴ • λΠϜϥΠϯͱৄࡉը໘ͰٻΊΒΕΔը૾αΠζ͕ҧ͏ • ͰɺΦϦδϯʹαΠζຖͷΦϒδΣΫτͭ͘Βͳ͍ • λΠϜϥΠϯͷը૾͚ͩImageFluxͰϦαΠζ
720x720 140KB o=1 (JPEG࠷దԽ) ϝϧΧϦετΞͷը૾ 720x720 50KB
720x720 140KB o=1 (JPEG࠷దԽ) ϝϧΧϦετΞͷը૾ 720x720 50KB αΠζ65%ݮ
720x720 140KB w=360 ϝϧΧϦετΞͷը૾ 360x360 15KB
720x720 140KB w=360 ϝϧΧϦετΞͷը૾ 360x360 15KB αΠζ90%ݮ
720x720 140KB w=360,f=webp ϝϧΧϦετΞͷը૾ 360x360 8KB
720x720 140KB w=360,f=webp ϝϧΧϦετΞͷը૾ 360x360 8KB αΠζ94%ݮ
ImageFluxͰϦαΠζ & WebPม w=360 or w=360,f=webp
ImageFluxͰϦαΠζ & WebPม w=720,o=1 or w=720,f=webp
ը૾ͷը࣭ௐ Before After
ը૾ͷը࣭ௐ Beforeɿ720x720 74KB Afterɿ1080x1080 102KB
ը૾ͷը࣭վળ • ࠓͷ8݄ޙҎ߱ʹग़͞Εͨݪੇେը૾ͷ • ղ૾Λ720x720͔Β1080x1080ʹมߋ • ը࣭ύϥϝʔλΛௐ • ΑΓߴը࣭Ͱ໌ͳը૾ʹ
ը૾ͷը࣭վળ • ը૾ͷදࣔεϐʔυ͍ํ͕Α͍ͷͰը૾αΠζۃྗ͍͑ͨ • ͱ͍͑ɺݪੇେͷը૾ͬͱߴը࣭ʹ͍ͨ͠ • ͜ͷ̎ͭτϨʔυΦϑͳͷͰɺαΠζͱը࣭ͷόϥϯεΛ͏·͘ௐ͢ Δඞཁ͕͋Δ
ը૾ͷը࣭վળ • ϝϧΧϦͷը૾ग़࣌ʹΫϥΠΞϯταΠυͰϦαΠζɺը࣭ௐ ͕ߦΘΕΔ • ύϥϝʔλࣗମαʔόαΠυͰมߋՄೳ • ը૾ͷαΠζ৴͚࣌ͩͰͳ͘ɺग़࣌ͷUXʹେ͖͘Өڹ͢Δ • ग़࣌ͷUXͷӨڹΛௐࠪ͢ΔͨΊʹA/BςετΛ࣮ࢪ্ͨ͠Ͱมߋ
ը૾ͷը࣭վળ Beforeɿ720x720 74KB Afterɿ1080x1080 102KB
ը૾Λ֦େ ͦͷ1 Beforeɿ720x720 74KB Afterɿ1080x1080 102KB
ը૾Λ֦େ ͦͷ2 Beforeɿ720x720 74KB Afterɿ1080x1080 102KB
ҰํͰɺ • ղ૾Ξοϓ & ߴը࣭ԽʹΑΓը૾ͷαΠζવ૿͑Δ • ৴ίετ૿ • ग़࣌ͷը૾Ξοϓϩʔυɺݪੇେը૾ͷදࣔʹ͕͔͔࣌ؒΔ •
UXԼ
͜ΕΒͷΛΒ͛ΔͨΊʹɺ • ImageFluxͷΫΥϦςΟύϥϝʔλͰը࣭Λௐʢe.g. q=75ʣ • ImageFluxͷσϑΥϧτύϥϝʔλΛར༻͢ΕίϯτϩʔϧύωϧͰ ੍ޚ͢Δ͜ͱՄೳ • ৄࡉը໘Ͱͷը૾දࣔͷํΛ •
λΠϜϥΠϯ͔Βৄࡉը໘ʹભҠͨ͠ࡍʹɺখ͍͞ը૾Λදࣔͨ͠ ޙͰେ͖͍ը૾ʹࠩ͠ସ͑ʢࠓiOS൛ͷΈʣ
·ͱΊ • ImageFluxͷಋೖʹΑΓΞϓϦͷσʔλ௨৴ྔݮͱUX্Λಉ࣌ʹ࣮ݱ • ը૾σʔλͷ௨৴ྔΛ30%Ҏ্ݮ • ΞϓϦͷUIσβΠϯͷมԽʹॊೈʹରԠͰ͖ΔΑ͏ʹͳͬͨ • ΦϦδϯͷετϨʔδʹผʑͷαΠζͷը૾Λஔ͢Δ͜ͱͳ͘ɺΦϯβϑϥ ΠͰը૾Λม
• εϚʔτϑΥϯΞϓϦ͕շదʹ͑ΔΑ͏ʹͳΔͨΊʹɺ • σʔλͷ௨৴ྔΛ͑Δ͕ॏཁ