{"id":21679235,"url":"https://github.com/hoppergee/heic-to","last_synced_at":"2025-05-16T08:03:20.659Z","repository":{"id":252094703,"uuid":"839411443","full_name":"hoppergee/heic-to","owner":"hoppergee","description":"Convert HEIC/HEIF images to JPEG, PNG in browser","archived":false,"fork":false,"pushed_at":"2025-05-07T02:56:51.000Z","size":14276,"stargazers_count":143,"open_issues_count":4,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-07T03:01:42.125Z","etag":null,"topics":["heic-to-jpeg","heic-to-png","heif-converter","image-conversion"],"latest_commit_sha":null,"homepage":"","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/hoppergee.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-07T14:53:33.000Z","updated_at":"2025-05-07T02:56:39.000Z","dependencies_parsed_at":"2024-08-07T18:00:00.821Z","dependency_job_id":"b5fb52fc-3dab-4fc8-b77a-e22f7857f6aa","html_url":"https://github.com/hoppergee/heic-to","commit_stats":null,"previous_names":["hoppergee/heic-to"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoppergee%2Fheic-to","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoppergee%2Fheic-to/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoppergee%2Fheic-to/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoppergee%2Fheic-to/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoppergee","download_url":"https://codeload.github.com/hoppergee/heic-to/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493381,"owners_count":22080126,"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":["heic-to-jpeg","heic-to-png","heif-converter","image-conversion"],"created_at":"2024-11-25T14:49:52.237Z","updated_at":"2025-05-16T08:03:20.653Z","avatar_url":"https://github.com/hoppergee.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# heic-to\n\nConvert HEIC/HEIF images to JPEG, PNG in browser using Javascript.\n\nInspired by [heic2any](https://github.com/alexcorvi/heic2any) and [libheif-web](https://github.com/joutvhu/libheif-web). The purpose of heic-to is to continuously follow up on releases of [libheif](https://github.com/strukturag/libheif) to be able to preview HEIC/HEIF images in browser.\n\nCurrently, heic-to is using [libheif 1.19.8](https://github.com/strukturag/libheif/releases/tag/v1.19.8) under the hood. \n\n| Release  | libheif  |\n| -------- | -------- |\n| 1.1.13   | 1.19.8   | \n| 1.1.12   | 1.19.7   | \n| 1.1.11   | 1.19.7   | \n| 1.1.10   | 1.19.7   | \n| 1.1.9    | 1.19.7   | \n| 1.1.8    | 1.19.7   | \n| 1.1.7    | 1.19.6   | \n| 1.1.6    | 1.19.5   | \n| 1.1.5    | 1.19.5   | \n| 1.1.4    | 1.19.4   | \n| 1.1.3    | 1.19.3   | \n| 1.1.2    | 1.19.2   | \n| 1.1.1    | 1.19.1   | \n| 1.1.0    | 1.19.0   | \n| 1.0.3    | 1.18.2   |\n| 1.0.2    | 1.18.2   |\n| 1.0.1    | 1.18.2   |\n| 1.0.0    | 1.18.1   |\n\n### Usage\n\n#### Check whether the image is HEIC or not \n\n```js\nimport { isHeic } from \"heic-to\"\n\nconst file = field.files[0]\nawait isHeic(file)\n```\n\n#### Convert HEIC to JPEG/PNG\n\n\n```js\nimport { heicTo } from \"heic-to\"\n\nconst file = field.files[0]\n\nconst jpeg = await heicTo({\n  blob: file,\n  type: \"image/jpeg\",\n  quality: 0.5\n})\n\nconst png = await heicTo({\n  blob: file,\n  type: \"image/png\",\n  quality: 0.5\n})\n```\n\n#### Cotent Security Policy\n\nWhen meets CSP issue like this:\n\n```\nRefused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive\n```\n\nFix it by using `csp/heic-to` \n\n```diff\n- import { heicTo } from \"heic-to\"\n+ import { heicTo } from \"heic-to/csp\"\n```\n\n#### Access global variable with IIFE build\n\nIf you would like to access heic-to with pure JavaScript without package builder like with CDN.\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/heic-to@1.1.12/dist/iife/heic-to.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  /*...*/\n  if (await HeicTo.isHeic(file)) {\n    const jpeg = await HeicTo({\n      blob: file,\n      type: \"image/jpeg\",\n      quality: 0.5\n    })\n    /*...*/\n  }\n  /*...*/\n\u003c/script\u003e\n```\n\n### Development guide\n\n#### How to fast test your changes on local?\n\n```bash\nyarn s\n```\n\nThis will open `http://127.0.0.1:8080/example/` for easy testing.\n\n#### How to build libheif.js from [libheif](https://github.com/strukturag/libheif) on Mac\n\n```bash\nbrew install cmake make pkg-config x265 libde265 libjpeg libtool\nbrew install emscripten\n\ngit clone git@github.com:strukturag/libheif.git\n```\n\nDid below changes from `build-emscripten.sh`\n```diff\n# EXPORTED_FUNCTIONS=$($EMSDK/upstream/bin/llvm-nm $LIBHEIFA --format=just-symbols | grep \"^heif_\\|^de265_\\|^aom_\" | grep \"[^:]$\" | sed 's/^/_/' | paste -sd \",\" -)\nEXPORTED_FUNCTIONS=$(/opt/homebrew/opt/llvm/bin/llvm-nm $LIBHEIFA --format=just-symbols | grep \"^heif_\\|^de265_\\|^aom_\" | grep \"[^:]$\" | sed 's/^/_/' | paste -sd \",\" -)\n```\n\nStart building\n```bash\ncd libheif\nmkdir buildjs\ncd buildjs\nUSE_WASM=0 ../build-emscripten.sh ..\n\n# Or build without unsafe-eval\nUSE_UNSAFE_EVAL=0 USE_WASM=0 ../build-emscripten.sh ..\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoppergee%2Fheic-to","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoppergee%2Fheic-to","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoppergee%2Fheic-to/lists"}