deno-content-dpr-worker
Deno Deploy環境で動くcontent-dpr-worker
PNG画像レスポンスにContent-DPRヘッダを付けるワーカー
https://github.com/TheTeamJ/deno-content-dpr-worker
https://gyazo.com/91e68113b78965528f63370d1501adf2/raw
PNG画像のバイナリを読んでDPIを取得している
deno-png-dpi-reader-writerを使った
Deno Deploy環境にDeno.Bufferが存在しなかったので、これを使わないreaderを新たに書いた
https://github.com/daiiz/deno-png-dpi-reader-writer/blob/master/reader_.ts
将来的にはwriterもこちらの実装に合わせていってよいと思う
使い方
https://png-content-dpr.deno.dev/?src=画像のURL
デモ
https://png-content-dpr.deno.dev/?src=https://raw.githubusercontent.com/TheTeamJ/deno-content-dpr-worker/main/sample/retina_menubar.png
https://png-content-dpr.deno.dev/?src=https://raw.githubusercontent.com/TheTeamJ/deno-content-dpr-worker/main/sample/retina_pancake.png