{"id":26502869,"url":"https://github.com/grassator/rain","last_synced_at":"2025-03-20T18:36:03.765Z","repository":{"id":2054651,"uuid":"2992544","full_name":"grassator/rain","owner":"grassator","description":"Auto-minimization tool for fluid images","archived":false,"fork":false,"pushed_at":"2012-03-10T09:10:06.000Z","size":240,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-04-09T14:49:39.426Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://kubyshkin.ru/rain/","language":"C++","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/grassator.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}},"created_at":"2011-12-16T04:07:05.000Z","updated_at":"2021-08-06T06:52:32.000Z","dependencies_parsed_at":"2022-08-29T02:40:48.202Z","dependency_job_id":null,"html_url":"https://github.com/grassator/rain","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Frain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Frain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Frain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Frain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grassator","download_url":"https://codeload.github.com/grassator/rain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244672148,"owners_count":20491322,"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":[],"created_at":"2025-03-20T18:36:03.280Z","updated_at":"2025-03-20T18:36:03.758Z","avatar_url":"https://github.com/grassator.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview\n\n**Rain** is a command line utility designed for minimizing border images for use\nin CSS, Qt and Android (right now requires small modification after processing).\nIn addition to that **rain** can split resulting minimized image in three\n(either vertical or horizontal) or nine parts for usage with CSS in older\nbrowsers or any other platform, like Cocoa (see NSDrawThreePartImage and\nNSDrawNinePartImage [reference][cocoa]).\n\n## How does rain work\n\n**Rain** works by comparing pixels in every direction to the one specified as\na starting point (center of the image by default). When it finds a pixel of\ndifferent color that means that we can't minimize any more in this direction.\n\nAfter initial scanning is done **rain** can use retreived information in\nseveral ways:\n\n- Minimize image and save it as a regular PNG file to use with CSS3\n  border-image property, or [9-patch image][android] for android UI development.\n\n- Output a series of image - three or nine depending on your need to be able to\n  use it for element with fluid height, width or both.\n\n- Print out offsets from each border in an easily-parsable and\n  human-readable JSON format to allow manual or automated usage in CSS/QSS files\n  for border-image property.\n\nSample usage may look like this:\n\n    rain -o minimized -a button.png\n\nIn this case **rain** will process `button.png`, minimize it and output into\nfile named `minimized.9.png` in nine-patch image format for android development.\nA complete list of possible command line arguments presented in the next\nchapter.\n\n## Command line parameters\n\nThere are several groups of options. Some groups allow simultanious use of\nflag and parameters while others don't. If you accidently violate these\nrestrictions you will be reminded of them by an error message printed to stderr.\n\n### Common options\n\n    \u003cinput_file\u003e\n\nThe last unnamed command line parameter is considered to be input file name.\nThis is the only required parameter. If you specify it alone, **rain**\nwill only try to analyze provided file without giving any output except for the\ncase where input file can't be read or isn't proper PNG file.\n\n    -o \u003coutput_base_name\u003e,  --output \u003coutput_base_name\u003e\n\nThis is basename for the **rain** output file(s). Don't specify an extension\nhere because depending on your output format it may be used to construct several\nfilenames (e.g. `basename-top.png`, `basename-bottom.png`, ...). By default\nbasename is constructed from input file name by removing extension.\n\n    -j,  --json\n\nOutput offsets from each border that are used in CSS3 border-image porperty\nin JSON format to stdout. Sample output look like this:\n`{\"top\":50,\"right\":15,\"bottom\":15,\"left\":15}`\n\n    -y \u003cinteger\u003e,  --y-start \u003cinteger\u003e\n\nSpecifies Y coordinate of starting point for the analysis. It is important when\nour image is assymetrical and repeating part lies either below or above the\ncenter. **Warning:** this parameter is always forced to be within image\nboundaries.\n\n    -x \u003cinteger\u003e,  --x-start \u003cinteger\u003e\n\nSame as above but for X coordinate of starting point.\n\n    --,  --ignore_rest\n\nStandard *nix flag that ignores the rest of the labeled arguments\nfollowing this flag.\n\n    --version\n\nDisplays version information and exits.\n\n    -h,  --help\n\nDisplays usage information and exits.\n\n\n### Minimization / resize\n\n*Options in this group are mutually exclusive.*\n\n    -a,  --android\n\nOutputs minimized [Android 9-patch image][android]\nwith `.9.png` extension.\n\n    -c,  --android-content\n\nSame as above but with content area specified inside of repeating part of\nthe image.\n\n    -m,  --minimize\n\nMinimizes image to be used as a border-image in CSS 3 or Qt stylesheets.\n**Warning:** with no basename specified this option overwrites input image.\n\n    -r \u003cWIDTHxHEIGHT\u003e,  --resize \u003cWIDTHxHEIGHT\u003e\n\nResizes image to provided dimensions. Essentially this is a simplified version\nof border-image technique where middle part is always repeated (CSS3 supports\nstretch as well). **Warning:** image dimensions are forced to be at least the\nsize of minimized image which is `(left + right + 1)x(top + bottom + 1)`.\n\n### Multiple images\n\n*Options in this group are mutually exclusive.*\n\nThis set of option is useful when you target systems that don't have some sort\nof border-image capability and require a set of image to provide support for\nresizeable custom UI elements. Systems like that include but not limited to\nCocoa and older browsers like IE8 and below.\n\n    -b,  --both\n\nCreates 9 images by first minimizing input image and then splitting into\nmultiple images based on the result of analysis. Output images are suffixed\nwith cardinal directions (e.g. `basename-north-west.png`). Center image has\nsuffix `middle`.\n\n    -t,  --vertical\n\nCreates 3 images by only splitting input vertically. Output suffixes are:\n`top`, `middle`, `bottom`.\n\n    -l,  --horizontal\n\nCreates 3 images by only splitting input horizontally. Output suffixes are:\n`left`, `middle`, `right`.\n\n## License\n\nCopyright (c) 2011 Dmitriy Kubyshkin\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n## Aknowledgements\n\nThis software makes use of open source code for some of its functionality. A big thank you to everybody who created the code that helps me build a better software.\n\n### [TCLAP (Templatized C++ Command Line Parser)](http://tclap.sourceforge.net/)\n\nCopyright (c) 2003, Michael E. Smoot .\nCopyright (c) 2004, Michael E. Smoot, Daniel Aarno .\nAll rights reverved.\n\nSee the file COPYING in the top directory of this distribution for\nmore information.\n\nTHE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\nTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\n\n### [LodePNG](http://lodev.org/lodepng/)\n\nCopyright (c) 2005-2011 Lode Vandevenne\n\nThis software is provided 'as-is', without any express or implied\nwarranty. In no event will the authors be held liable for any damages\narising from the use of this software.\n\nPermission is granted to anyone to use this software for any purpose,\nincluding commercial applications, and to alter it and redistribute it\nfreely, subject to the following restrictions:\n\n1. The origin of this software must not be misrepresented; you must not\nclaim that you wrote the original software. If you use this software\nin a product, an acknowledgment in the product documentation would be\nappreciated but is not required.\n\n2. Altered source versions must be plainly marked as such, and must not be\nmisrepresented as being the original software.\n\n3. This notice may not be removed or altered from any source\ndistribution.\n\n\n[android]: http://developer.android.com/guide/developing/tools/draw9patch.html\n[cocoa]: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Miscellaneous/AppKit_Functions/Reference/reference.html","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrassator%2Frain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrassator%2Frain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrassator%2Frain/lists"}