When mocking up layouts, I want to ensure that the HTML I’m building wraps real images in the correct aspect ratios. I also want to be able to fiddle with the sizes without getting distracted by squashed/stretched faces or by color schemes that are anethema to a particular design. I’d like something akin to a visual “Lorem ipsum…”, that says “Hey! An image is going to go here! At some point! In the future!” Importantly for some future work, I want these images to be autogenerated.
So, PyPlaceholder
. Using PyPNG
as a base, it generates s very
simple image that you can stick into a layout to hold the place of images
to come.
They look like this:
Or like this:
I know, right? Whatever width you’d like, whatever foreground, whatever background. It’s like magic.
You can build your own placeholders for as long as my server holds up: placeholder.mikewest.org
Usage: placeholder.py [options]
Options:
--version show program's version number and exit
-h, --help show this help message and exit
--verbose Verbose mode
-o OUT, --output=OUT Output file
--background=RRGGBB Background color in hex (`RRGGBB`) format
--foreground=RRGGBB Foreground color in hex (`RRGGBB`) format
--width=WIDTH Width of placeholder
--height=HEIGHT Height of placeholder
--no-border Suppress rendering of border around the placeholder
image.
Added a --no-metadata
argument to the command line tool for Norm.
Setting this flag removes the image size and aspect ratio information
from the bottom-right of the generated image.
@TODO: Make the metadata block positionable.
Added metadata to the rendered image:
If there’s enough room, [WIDTH]x[HEIGHT] ([ASPECT RATIO])
will be
rendered in the bottom-right corner of the image, using inverted
background and foreground colours.
If there’s not quite enough room for that string, we’ll try the
shorter string [WIDTH]x[HEIGHT]
. If there’s not even room for
that, we’ll leave off the metadata entirely.
Common ratios (16:9, 4:3) are given a margin of error for those pesky half-pixel roundings.
Change usage: pass in individual properties instead of the OptionParse object. This makes it possible to use as a lib.
Added error handling for bad hex values.
Dropped the margin of error, and converted the aspect ratio calculation to floating point.
Making BSD license explicit.
Closes issue #1.
Initial public release.