Easily generate placeholder pictures for your users.
It's really good at rendering one or two letters inside a colored square, and terrible at everything else.
If you guessed pip, you are totally correct!
pip install placeholder-pics
from placeholder_pics import PlaceholderPic placeholder = PlaceholderPic('KF') placeholder.image.save('KF.png')
image property is an instance of
PIL.Image.Image. This means you can save it however you like, or even apply additional manipulations. You could rotate it, for example, which would be kind of silly. Don't do that!
The only required parameter to
Placeholder is the text you want to render.
The following optional parameters are accepted.
||Image dimensions (always square)|
||Text color (hex format, with leading #)|
||Background color (hex format, with leading #). If
||File name of the font you'd like to use. Source Sans Regular is included by default. See
||Font size, in points. If
Are you SO mad because of bugs or missing features?!?!
Just kidding, you know what to do. Submit an issue.
Placeholder Pics is distributed under the MIT License. Learn more at http://opensource.org/licenses/mit-license.php
Copyright (c) 2016 Kyle Fox
Permission 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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE 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.