Changeset - 749e5561f79c
[Not reviewed]
0 1 0
Branko Majic (branko) - 7 years ago 2016-12-03 15:17:02
branko@majic.rs
PYD-7: Updated usage instructions to mention multiple output formats.
1 file changed with 17 insertions and 1 deletions:
0 comments (0 inline, 0 general)
docs/usage.rst
Show inline comments
 
@@ -85,6 +85,12 @@ Finally, the resulting identicons can be in different formats::
 
  identicon_ascii = generator.generate("john.doe@example.com", 200, 200,
 
                                       output_format="ascii")
 

	
 
Supported output formats are dependant on the local Pillow installation. For
 
exact list of available formats, have a look at `Pillow documentation
 
<https://pillow.readthedocs.io/>`_. The ``ascii`` format is the only format
 
explicitly handled by the *Pydenticon* library itself (mainly useful for
 
debugging purposes).
 

	
 
Using the generated identicons
 
------------------------------
 

	
 
@@ -93,9 +99,11 @@ either to be stored somewhere on disk, or maybe streamed back to the user via
 
HTTP response. Since the generate function returns raw data, this is quite easy
 
to achieve::
 

	
 
  # Generate same identicon in two different formats.
 
  # Generate same identicon in three different formats.
 
  identicon_png = generator.generate("john.doe@example.com", 200, 200,
 
                                     output_format="png")
 
  identicon_gif = generator.generate("john.doe@example.com", 200, 200,
 
                                     output_format="gif")
 
  identicon_ascii = generator.generate("john.doe@example.com", 200, 200,
 
                                       output_format="ascii")
 

	
 
@@ -104,6 +112,10 @@ to achieve::
 
  f.write(identicon_png)
 
  f.close()
 

	
 
  f = open("sample.gif", "wb")
 
  f.write(identicon_gif)
 
  f.close()
 

	
 
  # ASCII identicon can be printed-out to console directly.
 
  print identicon_ascii
 

	
 
@@ -114,6 +126,10 @@ Working with transparency
 
.. note::
 
   New in version ``0.3``.
 

	
 
.. warning::
 
   The only output format that properly supports transparency at the moment is
 
   ``PNG``. If you are using anything else, transparency will not work.
 

	
 
If you ever find yourself in need of having a transparent background or
 
foreground, you can easily do this using the syntax
 
``rgba(224,224,224,0)``. All this does is effectively adding alpha channel to
0 comments (0 inline, 0 general)