{"id":16414579,"url":"https://github.com/wapmorgan/imagery","last_synced_at":"2025-07-02T22:34:08.871Z","repository":{"id":62546557,"uuid":"78664553","full_name":"wapmorgan/Imagery","owner":"wapmorgan","description":"Imagery simplifies image manipulations.","archived":false,"fork":false,"pushed_at":"2018-02-13T21:50:36.000Z","size":21,"stargazers_count":25,"open_issues_count":0,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-03T16:52:06.525Z","etag":null,"topics":["image-processing"],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/wapmorgan.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":"2017-01-11T17:56:42.000Z","updated_at":"2022-10-25T11:25:55.000Z","dependencies_parsed_at":"2022-11-02T22:01:53.893Z","dependency_job_id":null,"html_url":"https://github.com/wapmorgan/Imagery","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/wapmorgan/Imagery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wapmorgan%2FImagery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wapmorgan%2FImagery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wapmorgan%2FImagery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wapmorgan%2FImagery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wapmorgan","download_url":"https://codeload.github.com/wapmorgan/Imagery/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wapmorgan%2FImagery/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263227389,"owners_count":23433892,"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":["image-processing"],"created_at":"2024-10-11T06:54:29.965Z","updated_at":"2025-07-02T22:34:08.831Z","avatar_url":"https://github.com/wapmorgan.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Imagery simplifies image manipulations.\n\n_Imagery_ supports:\n- resizing\n- cropping\n- flipping and rotating\n- making collages\n- applying filters and effects\n\n[![Composer package](http://composer.network/badge/wapmorgan/imagery)](https://packagist.org/packages/wapmorgan/imagery)\n[![Latest Stable Version](https://poser.pugx.org/wapmorgan/imagery/v/stable)](https://packagist.org/packages/wapmorgan/imagery)\n[![Total Downloads](https://poser.pugx.org/wapmorgan/imagery/downloads)](https://packagist.org/packages/wapmorgan/imagery)\n[![License](https://poser.pugx.org/wapmorgan/imagery/license)](https://packagist.org/packages/wapmorgan/imagery)\n\n1. **Installation**\n2. **API**\n\n# Installation\n* Composer package:\n```\n  composer require wapmorgan/imagery\n```\n\n# API\n## Imagery\n```php\nuse Imagery\\Imagery;\n```\n### Opening\nCreate new Imagery object:\n- `$image = Imagery::open($filename);` - from a file.\n- `$image = Imagery::create($width, $height);` - new image\n- `$image = new Imagery(imagecreatefrombmp('image.bmp'));` - from a resource\n\n### Saving\n- `public function save($filename, $quality = 75, $format = null)` - saves image to disk.\nQuality is an integer value between `0` (worst) and `100` (best). Default is `75`. Quality is applicable only to JPEG, PNG, WEBP. If `$format` can not be determined by filename extension, specifcy it explicitly.\n\nFormats supports:\n\n| Operation | Formats                                                  |\n|-----------|----------------------------------------------------------|\n| Opening   | jpeg, png, gif, bmp, wbmp, xbm, xpm, webp (php \u003e= 7.1.0) |\n| Saving    | jpeg, png, gif, bmp, wbmp, xbm, webp (php \u003e= 7.1.0)      |\n\n### Properties\n- `$image-\u003ewidth` - width of image\n- `$image-\u003eheight` - height of image\n- `$image-\u003eresource` - original gd-resource of image (you can use it with gd-functions)\n\n### Resize \u0026\u0026 Zoom\n- `public function resize(int $width, int $height)` - resizes an image to `$width` X `$height`\n- `public function zoomWidthTo(int $size)` - changes proportionally image width to `$size`\n- `public function zoomHeightTo(int $size)` - changes proportionally image height to `$size`\n- `public function zoomMaxSide(int $size)` - zoomes proportionally larger side to `$size`, if needed\n\n### Crop\n- `public function crop($x, $y, $x2, $y2)` - cuts a rectangular piece of image\n- `public function decreaseSide($side, int $size)` - deletes a piece of image from specific side. For example, if $side=top and $size=100, 100px from top will be deleted.\n\n### Rotation \u0026\u0026 Mirroring\n- `public function rotate($angle, $bgColor = 0)` - rotates an image. `True` equals 90°, `False` equals -90°.\n- `public function flip($horizontally = true)` - flips an image horizontally or vertically.\n\n### Collage\n- `public function appendImageTo($side, Imagery $appendix, int $modifiers)` - appends an image (`$appendix`) to current image at `$side` (`top|bottom|left|right`). Modifiers:\n  - `Imagery::ZOOM_IF_LARGER` - appendix' height will be zoomed (not resized) if it's larger than current image's one (when appending to left or right side); appendix' width will be zoomed (not resized) if it's larger than current image's one (when appending to top or bottom side);\n- `public function placeImageAt($x, $y, Imagery $image)` - places an image atop current image at `$x` X `$y`.\n\n- `public function placeImageAtCenter(Imagery $image)` - places an image in the center of current image.\n\n### Effects\n- `public function filter($filter)` - applies grayscale or negate filter. Pass `Imagery::FILTER_NEGATE` or `Imagery::FILTER_GRAYSCALE` as $filter.\n\n  Grayscale:\n\n  ![Original](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/original.png)\n  -\u003e\n  ![Grayscale](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/grayscale_original.png)\n\n  Negate:\n\n  ![Original](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/original.png)\n  -\u003e\n  ![Negate](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/negate_original.png)\n\n- `public function changeContrast($newValue)` - changes contrast of image. New values can be in range from 100 (max contrast) to -100 (min contrast), 0 means no change.\n\n  ![Original](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/original.png)\n  -\u003e\n  ![Negate](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/contrast_original.png)\n\n- `public function changeBrightness($newValue)` - changes brightness of image. New values can be in range from 255 (max brightness) to -255 (min brightness), 0 means no change.\n\n  ![Original](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/original.png)\n  -\u003e\n  ![Negate](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/brightness_original.png)\n\n- `public function colorize($red, $green, $blue, $alpha = 127)` - changes colors of image. Colors (`$red, $green, $blue`) can be in range from 255 to -255. `$alpha` from 127 to 0.\n\n  ![Original](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/original.png)\n  -\u003e\n  ![Negate](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/colorize_original.png)\n\n- `public function blur($method)` - blurs an image. Method can be `Imagery::GAUSSIAN_BLUR` or `Imagery::SELECTIVE_BLUR`.\n\n  ![Original](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/original.png)\n  -\u003e\n  ![Negate](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/blur_original.png)\n\n- `public function smooth($level)` - smooths an image. Level of smoothness can be in range from 0 to 8. 8 is un-smooth.\n\n  ![Original](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/original.png)\n  -\u003e\n  ![Negate](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/smooth_original.png)\n\n- `public function pixelate($blockSize = 5, $useModernEffect = true)` - pixelates an image. `$blockSize` is size of pixel block.\n\n  ![Original](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/original.png)\n  -\u003e\n  ![Negate](https://github.com/wapmorgan/Imagery/releases/download/1.0.0/pixelate_original.png)\n\n## Tools\nThere's a tools class: `Imagery/Tools`.\n\n- `static public function pHash(Imagery $image, $sizes = array(8, 8))`\n\n  Calculates Perceptual hash of image.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwapmorgan%2Fimagery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwapmorgan%2Fimagery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwapmorgan%2Fimagery/lists"}