{"id":24206554,"url":"https://github.com/andyg2/repage","last_synced_at":"2026-01-29T17:32:59.238Z","repository":{"id":72757360,"uuid":"521789651","full_name":"andyg2/repage","owner":"andyg2","description":"Repage removes the background based on a threshold, then positions the remaining image centrally in the specified output size.","archived":false,"fork":false,"pushed_at":"2022-08-05T23:14:16.000Z","size":852,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-22T05:45:13.639Z","etag":null,"topics":["background-removal","centering","crop-image","gd","image-processing","php7","resize-images"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/andyg2.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}},"created_at":"2022-08-05T22:20:58.000Z","updated_at":"2023-02-10T21:51:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"c19a8926-698d-4ba8-8c26-42bdd966268d","html_url":"https://github.com/andyg2/repage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andyg2/repage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyg2%2Frepage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyg2%2Frepage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyg2%2Frepage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyg2%2Frepage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andyg2","download_url":"https://codeload.github.com/andyg2/repage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyg2%2Frepage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28881982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T16:41:59.663Z","status":"ssl_error","status_checked_at":"2026-01-29T16:39:39.641Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["background-removal","centering","crop-image","gd","image-processing","php7","resize-images"],"created_at":"2025-01-14T00:34:20.486Z","updated_at":"2026-01-29T17:32:59.226Z","avatar_url":"https://github.com/andyg2.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Image repager - attempts to remove background, crops and positions centrally\n\n#### From this\n\n\u003cimg src=\"https://github.com/andyg2/repage/raw/master/source/absolute-vodka.jpg?raw=true\" width=\"400\"\u003e\n\n#### To this\n\n\u003cimg src=\"https://github.com/andyg2/repage/raw/master/dest/absolute-vodka.jpg?raw=true\" width=\"400\"\u003e\n\n### DIRECTORIES\n\n```php\n$p['source'] = './source/'; // path of source images with trailing slash\n$p['dest'] = './dest/'; // path of destination images with trailing slash\n```\n\n### FILE NAMING\n\n#### Adds dimentions to file [basename]-1200x900.jpg and, if destination exists increments filename is_integer [basename]-1200x900-2.jpg\n\n```php\n$p['autoname'] = false;\n```\n\n### DESTINATION_DIMENSIONS\n\n#### defaults to 800 x 600 if omitted\n\n```php\n$p['destination_width'] = 1200;\n$p['destination_height'] = 900;\n```\n\n### BACKGROUND_COLOR - defaults to white if omitted\n\n#### Specify rgb values\n\n```php\n$p['background_color']['r'] = 127;\n$p['background_color']['g'] = 127;\n$p['background_color']['b'] = 127;\n```\n\n#### Or: Use hex value\n\n```php\n$p['background_color'] = '#CCCCCC';\n```\n\n#### Or: Detect background colors - average color of 10 pixels in from each corder\n\n```php\n$p['background_color'] = 10; // (auto)\n```\n\n### IMAGE_PADDING\n\n#### Add 20 pixels additional border to crop\n\n```php\n$p['image_padding'] = 20;\n```\n\n### CROPPING_THRESHOLD\n\n#### Automatic\n\n```php\n$p['cropping_threshold'] = 'auto';\n```\n\n#### Or Specify a threshold\n\n```php\n$p['cropping_threshold'] = 50;\n```\n\n## Examples\n\n### Batch images\n\n#### args for batch_repage($p)\n\n##### Process all images in ./source/*.{png,jpeg,jpg,gif}, save as original filenames in ./dest/* as a 1200 x 900 image, get background color from 10px in from the corners, add additional 20px padding to cropped image.\n\n```php\n$p['source'] = './source/';\n$p['dest'] = './dest/';\n$p['autoname'] = false;\n$p['destination_width'] = 1200;\n$p['destination_height'] = 900;\n$p['background_color'] = 10;\n$p['image_padding'] = 20;\n$p['cropping_threshold'] = 'auto';\n```\n\n### Single image\n\n#### args for repage_image($p)\n\n##### Process './source/jack-daniels.jpeg', save as './dest/jack-daniels-400x300.jpeg' (autoname) as a 400 x 300 image, white background color for fropping and fill, add 100px padding around cropped image.\n\n```php\n$p['input_image'] = './source/jack-daniels.jpeg';\n$p['output_image'] = './dest/jack-daniels.jpeg';\n$p['autoname'] = true;\n$p['destination_width'] = 400;\n$p['destination_height'] = 300;\n$p['background_color']['r'] = 255;\n$p['background_color']['g'] = 255;\n$p['background_color']['b'] = 255;\n$p['image_padding'] = 100;\n$p['cropping_threshold'] = 'auto';\n```\n\n#### Source\n\u003cimg src=\"https://github.com/andyg2/repage/blob/master/source/jack-daniels.jpeg?raw=true\" width=\"400\"\u003e\n\n#### Result\n\u003cimg src=\"https://github.com/andyg2/repage/blob/master/dest/jack-daniels-400x300.jpeg?raw=true\" width=\"400\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyg2%2Frepage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandyg2%2Frepage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyg2%2Frepage/lists"}