{"id":24430577,"url":"https://github.com/hlustikp/imagy","last_synced_at":"2026-04-29T23:32:31.779Z","repository":{"id":45999661,"uuid":"376567604","full_name":"HlustikP/Imagy","owner":"HlustikP","description":"Image conversion and manipulation library with node bindings","archived":false,"fork":false,"pushed_at":"2023-10-20T10:03:24.000Z","size":32752,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-21T05:19:51.556Z","etag":null,"topics":["cpp","image","js","node","node-gyp","nodejs","webp"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HlustikP.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-13T14:45:18.000Z","updated_at":"2022-07-20T16:42:42.000Z","dependencies_parsed_at":"2023-02-08T21:01:05.151Z","dependency_job_id":null,"html_url":"https://github.com/HlustikP/Imagy","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HlustikP%2FImagy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HlustikP%2FImagy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HlustikP%2FImagy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HlustikP%2FImagy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HlustikP","download_url":"https://codeload.github.com/HlustikP/Imagy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243457244,"owners_count":20294022,"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":["cpp","image","js","node","node-gyp","nodejs","webp"],"created_at":"2025-01-20T14:31:48.260Z","updated_at":"2025-12-30T01:05:12.111Z","avatar_url":"https://github.com/HlustikP.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Image conversion and manipulation library with node binding\n\nRequires either x64 Windows 10 (might run on Windows Server, not tested)\nor x64 Debian-based system with support for glibc `2.31` or higher.\nYou can check your glibc version with:\n```bash\nls /lib/x86_64-linux-gnu/ | grep -E '^libc-[0-9]\\.[0-9]{1,2}\\.so$'\n```\n\n## Features\n### Supported Image Formats:\n- Conversion in all directions: BMP, PNG, JPEG, WEBP, TIFF\n- Conversion in one direction only: GIF -\u003e animated WEBP\n- [experimental] Conversion in one direction only: AVIF -\u003e BMP, PNG, JPEG, WEBP, TIFF\n### Image Manipulation:\n- Resizing (unanimated images only)\n- Flipping (unanimated images only)\n\nImagy is a library that uses a mixture of existing libraries (Boost::GIL, libpng, libjpeg, libwebp) and self-built decoders to provide\nan easy-to-use library interface for image conversion and manipulation. All images are internally\nstored as a (decoded) pixel array to allow fast operations on the data. De- and encoding are only\never done upon FileIO.\n\nAdditionally, the en- and decoding routines for animated images make use of multithreading to\nspeed up the process.\n\nUnlike other packages, imagy will NOT need to download additional files in order to run as an npm package.\nThe size you see under `Unpacked Size` on npm is the actual size.\n\n## Usage\nThis library comes with pre-built binaries. You can install the package with\n```\nnpm i imagy\n```\n\nInlude the package into your js application with:\n```js\nconst imagy = require('imagy');\n```\n\nFor quick image conversions the library implements the `convert` and `convertSync` functions:\n```js\nconst imagy = require('imagy');\n\nimagy.convertSync({\n            'image': 'path/to/file.jpg',\n            'outName': 'path/to/target.png',\n        });\n\n// Alternate way without intermediate object:\nimagy.convertSync(\"inputFile\", \"outputFile\");\n```\n```js\nconst imagy = require('imagy');\n\n// Converts asynchronously and returns a promise\nawait imagy.convert({\n            'image': 'path/to/file.jpg',\n            'outName': 'path/to/target.png',\n        });\n\n// Alternate way without intermediate object:\nawait imagy.convert(\"inputFile\", \"outputFile\");\n```\nThese functions take an Object with two properties as an argument. The first `image` is the path to the file to be converted\nand the second `outName` is the target. The function tries to infer the input's image type from the **file extension**,\nor if none is found or the one used is unknown, tries to parse the **file header** to get information on the image type. \nThe `convert` function returns a promise that, if resolved, returns\nand Object with `finished`, `error` and `img`(path to target) keys.\n\nYou can also use the `Image` class:\n```js\nconst imagy = require('imagy');\n\nconst img = new imagy.Image('path/to/input/file.png');\n\nimg.writeToFileSync('some/image.jpg');\n\n// async variant\nawait img.writeToFile('another/image.bmp');\n```\n**Note** though that this way the underlying image data are only freed once the `Image` instance\ngets garbage collected, which triggers the underlying cpp-class's destructor.\n\nImage objects also have access to the `rescale` and `rescaleSync` methods, which return the \ncalling object, so you might use them as follows:\n```js\nconst imagy = require('imagy');\nconst img = new imagy.Image('path/to/input/file.png');\n\n//          (HEIGHT, WIDTH)\nimg.rescaleSync(0, 4000).writeToFileSync(targetFile);\n```\nA `0` argument here indicates, that the dimension should be calculated in such a way that the image\nproportions are retained.\n\nSee the [the according doc file](docs/BINDING.md) for a full documentation.\n\n## Build Requirements\nThis package has been built and tested on Windows 10, Kali Linux 2021.4 x64\nand Ubuntu 20.04.4 LTS via WSL2.\n\nLibrary Specifcs:\n- C++ 17 or higher\n- Ninja Build System v1.11+\n- msvc (windows) or gcc (linux)\n- CMake Version 3.9+\n- Windows x64 or a debian-based Linux distro x64\n- A few libraries are needed, refer to the Installation reference [HERE](#installation)\n\nNode-Binding Specifics:\n- npm 8.0+\n- Node v14.0+\n- node-gyp v9.0+\n`$ npm install -g node-gyp`\nNote though that `node-gyp` needs at least `Python v3.7` to be installed.\nWindows: https://www.python.org/downloads/\nFor Ubuntu systems:\n\n`sudo apt install software-properties-common -y`\n\n`sudo add-apt-repository ppa:deadsnakes/ppa -y`\n\n`sudo apt update`\n\n`sudo apt install python3.8 -y`\n\nVerify via `python3.8 --version`\n\nEasiest way to make it accessable to `node-gyp` is to setup a `PYTHON` environment variable to the path of the `Python` executable.\n\n## Installation\nWIP\n# Windows\n- Use the VS Dev Console for the c++ library and another shell for the binding.\n- Download, compile and install the following libraries: `Boost Header-only`,\n`libpng`, `libjpeg-turbo`, `libwebp` and `zlib`. Header files should be copied into the\n`src/headers` directory, the compiled libraries into the `src/libs/PRESET` one.\n\n# Linux\n- ZLIB: `sudo apt-get install zlib1g-dev`\n- libpng: `sudo apt install libpng-dev`\n- libjpeg: Follow the build and install instructions on https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/BUILDING.md\n\n## Testing\nThe project includes test suites for both the c++ library and the node binding. The c++ tests are \ndone via Google's GTest and can be triggered by going into the `tests` directory inside the build folder.\nNote though that this is currently **Windows only**.\n\nThe binding includes the Jest test framework and testing can be triggered after the build process via\nexecuting `npm test` or `npx jest` inside the root directory.\n\n## Troubleshooting\n- Problem: Compiling the c++ library succeeds but compiling the binding with `node-gyp`throws linker errors. \n\u003e Solution: Check whether both, the library and the binding, are build for the same architecture (32 vs 64 bit), the same build type  (Release etc.) and the same Toolset and runtime libraries.\nIf that doesnt help, try running the `node-gyp` commands in sequence: `node-gyp configure` and `node-gyp build`.\n- Problem: I linked everything and every library has been found by cmake but it still throws linker errors on Linux.\n\u003e Solution: Try executing `ninja` with root privileges\n\n## TODO:\n- Expand the README\n- Support more formats (working on jpeg 2000 and avif)\n- Expose the libweb configs api to enable finetuning of animated images\n\n## Attributions\nAll images used for unit testing have their source credited [HERE](tests/media/ATTRIBUTIONS.md)\n(needs the related submodule to be installed).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlustikp%2Fimagy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhlustikp%2Fimagy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlustikp%2Fimagy/lists"}