{"id":16589872,"url":"https://github.com/leechy/imgsupport","last_synced_at":"2025-10-03T21:09:42.413Z","repository":{"id":18320714,"uuid":"21499705","full_name":"leechy/imgsupport","owner":"leechy","description":"Detecting support for JPEG XL, AVIF, WebP, JPEG 2000, JPEG XR, and SVG to supply the best image for the UA","archived":false,"fork":false,"pushed_at":"2023-11-28T22:17:11.000Z","size":10,"stargazers_count":64,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T14:11:18.104Z","etag":null,"topics":["avif","css","jpeg-xl","jpeg-xr","jpeg2000","jpegxl","jxl","webp"],"latest_commit_sha":null,"homepage":"https://github.com/leechy/imgsupport","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leechy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2014-07-04T14:25:12.000Z","updated_at":"2024-11-20T17:44:28.000Z","dependencies_parsed_at":"2023-10-14T14:05:19.076Z","dependency_job_id":null,"html_url":"https://github.com/leechy/imgsupport","commit_stats":{"total_commits":9,"total_committers":3,"mean_commits":3.0,"dds":0.2222222222222222,"last_synced_commit":"0b3097049fe2d0f377424a44dc8cecdf5be94634"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leechy%2Fimgsupport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leechy%2Fimgsupport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leechy%2Fimgsupport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leechy%2Fimgsupport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leechy","download_url":"https://codeload.github.com/leechy/imgsupport/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830915,"owners_count":20354850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["avif","css","jpeg-xl","jpeg-xr","jpeg2000","jpegxl","jxl","webp"],"created_at":"2024-10-11T23:10:15.603Z","updated_at":"2025-10-03T21:09:37.361Z","avatar_url":"https://github.com/leechy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# imgsupport\n\nDetecting support for AVIF, WebP, JPEG 2000, JPEG XR and SVG to supply the best image for the UA\n\n## Install\n\nDownload/fork the script to your server.\n\nInsert script before any `\u003clink\u003e` tag to css file, so browser will start to download right images.\n\n```\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eMy Page\u003c/title\u003e\n    \u003cscript src=\"imgsupport.js\"\u003e\u003c/script\u003e\n    ...\n    \u003clink rel=\"stylesheet\" href=\"mystyles.css\"\u003e\n    ...\n```\n\n## What this script do?\n\nLike modernizr, it injects one or a few CSS class names to the document element, e. g. `\u003chtml\u003e`, according to which image formats are supported by the browser:\n\n- `jxl` – if browser supports JPEG XL, then this class will be added. Currently it's Chrome and Firefox behind a flag.\n- `avif` – if browser supports AVIF, then this class will be added. Currently it's available on Chrome and Opera (not Edge) and in Firefox it's still behind a flag.\n- `webp` – it's already in all modern browsers. But be careful Safari started to support it not that long ago and it's available only in v14+ (BigSur, iOS14+).\n- `jp2` – browser supports JPEG 2000. It's Safari for Mac OS X and all browsers for iOS (based on iOS WebKit).\n- `jpx` – browser supports JPEG XR... Internet Explorer 9+ and old MS Edge till v18.\n- `svg` – all modern browsers, but this class is set only if none of the above formats are supported. Currently it's Firefox only.\n- `png` – if even SVG is not supported... fallback variant.\n- Additionally are added classes if the format is not supported: `notjxl`, `notavif`, `notwebp`, `notjp2`, `notjpx` and `notsvg`.\n\n### Example results\n\nChrome\n\n```\n\u003chtml class=\"notjxl avif webp notjpx notjp2\"\u003e\n```\n\nSafari\n\n```\n\u003chtml class=\"notjxl notavif webp notjpx jp2\"\u003e\n```\n\nFirefox\n\n```\n\u003chtml class=\"notjxl notavif webp notjpx notjp2 svg\"\u003e\n```\n\n## Usage\n\nYou can use css-cascade to specify what kind of image your browser must download:\n\n```\n.jxl .myelem {\n  background-image: url('myimage.jxl');\n}\n.avif.notjxl.notwebp .myelem {\n  background-image: url('myimage.avif');\n}\n.webp.notjxl.notavif .myelem {\n  background-image: url('myimage.webp');\n}\n.jpx.notavif.notwebp .myelem {\n  background-image: url('myimage.wdp');\n}\n.jp2.notavif.notwebp .myelem {\n  background-image: url('myimage.jp2');\n}\n.svg .myelem {\n  background-image: url('myimage.svg');\n}\n.png .myelem {\n  background-image: url('myimage.png');\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleechy%2Fimgsupport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleechy%2Fimgsupport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleechy%2Fimgsupport/lists"}