{"id":19325260,"url":"https://github.com/preco21/merge-img","last_synced_at":"2025-04-06T14:11:13.832Z","repository":{"id":45763017,"uuid":"80739908","full_name":"preco21/merge-img","owner":"preco21","description":"Merge multiple images into a single image","archived":false,"fork":false,"pushed_at":"2024-02-01T04:24:16.000Z","size":3560,"stargazers_count":95,"open_issues_count":17,"forks_count":27,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T13:08:49.369Z","etag":null,"topics":["compose","concat","convert","image","manipulation","merge"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/preco21.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-02T15:44:18.000Z","updated_at":"2025-02-05T23:40:17.000Z","dependencies_parsed_at":"2024-06-18T13:45:13.704Z","dependency_job_id":"5e3d82ad-68d1-4f7e-ad70-d2739a844de5","html_url":"https://github.com/preco21/merge-img","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preco21%2Fmerge-img","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preco21%2Fmerge-img/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preco21%2Fmerge-img/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preco21%2Fmerge-img/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/preco21","download_url":"https://codeload.github.com/preco21/merge-img/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247492513,"owners_count":20947544,"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":["compose","concat","convert","image","manipulation","merge"],"created_at":"2024-11-10T02:09:23.075Z","updated_at":"2025-04-06T14:11:13.813Z","avatar_url":"https://github.com/preco21.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# merge-img\n\n[![Code Style Prev](https://img.shields.io/badge/code%20style-prev-32c8fc.svg)](https://github.com/preco21/eslint-config-prev)\n[![NPM Version](https://img.shields.io/npm/v/merge-img.svg)](https://www.npmjs.com/package/merge-img)\n[![Build Status](https://travis-ci.org/preco21/merge-img.svg?branch=master)](https://travis-ci.org/preco21/merge-img)\n[![Dependency Status](https://dependencyci.com/github/preco21/merge-img/badge)](https://dependencyci.com/github/preco21/merge-img)\n\n\u003e Merge multiple images into a single image\n\n`merge-img` merges given images into a single image in right order. This will be helpful in a situation when you have to generate a preview of multiple images into a single image. This module is based on [`Jimp`][jimp] for image processing.\n\n![figure](https://rawgit.com/preco21/merge-img/master/media/figure.png)\nImage credit: https://www.pexels.com/\n\n## Install\n\n```bash\n$ npm install merge-img\n```\n\n## Usage\n\n```javascript\nimport mergeImg from 'merge-img';\n\nmergeImg(['image-1.png', 'image-2.jpg'])\n  .then((img) =\u003e {\n    // Save image as file\n    img.write('out.png', () =\u003e console.log('done'));\n  });\n```\n\n## API\n\n### mergeImg(images[, options])\n\n* `images` Array of (String | Object | Buffer | [Jimp][jimp]) - List of images to concat. If `String` is passed, it will be considered to the file path. Also you can pass other [Jimp][jimp] object. An `Object` entry can have following options:\n  * `src` _`String`_ or `Buffer` - A single image source to concat.\n  * `offsetX` Number (optional) - `x` offset to affect this image. Default is `0`.\n  * `offsetY` Number (optional) - `y` offset to affect this image. Default is `0`.\n* `options` Object (optional)\n  * `direction` Boolean - Direction of the merged image. If this value is `true`, the images will be merged vertically (column). Otherwise, the images will be merged horizontally (row). Default is `false`.\n  * `color` Number (hex) - Default background color represented by RGBA hex value. Default is `0x00000000`.\n  * `align` String - Aligning of given images. If the images are not all the same size, images will be sorted to largest image. Possible values are `start`, `center` and `end`. Default is `start`.\n  * `offset` Number - Offset in pixels between each image. Default is `0`.\n  * `margin` (Number | String | Object) - Margin of the result image. If `Number` or `String` is passed, it will be considered as [standard css shorthand properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties) (e.g. '40 40 0 10'). An `Object` entry can have following options:\n    * `top` Number (optional) - Margin on top side of result image. Default is `0`.\n    * `right` Number (optional) - Margin on right side of result image. Default is `0`.\n    * `bottom` Number (optional) - Margin on bottom side of result image. Default is `0`.\n    * `left` Number (optional) - Margin on left side of result image. Default is `0`.\n\nReturns a `Promise` that contains [`Jimp`][working-with-jimp] object.\n\n## License\n\n[MIT](https://preco.mit-license.org/)\n\n[jimp]: https://github.com/oliver-moran/jimp\n[working-with-jimp]: https://github.com/oliver-moran/jimp#writing-to-files-and-buffers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreco21%2Fmerge-img","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpreco21%2Fmerge-img","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreco21%2Fmerge-img/lists"}