Skip to content

Commit

Permalink
Merge pull request #152 from Valentin-Metz/master
Browse files Browse the repository at this point in the history
Improved image generation
  • Loading branch information
canismarko authored Dec 31, 2023
2 parents 8372bb6 + d037493 commit 11bd8b3
Show file tree
Hide file tree
Showing 10 changed files with 514 additions and 322 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand Down
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Generated output PDFs (and intermediate files)
examples/*.pdf
examples/*.aux
examples/*.tex
*.pdf
*.aux
*.tex

# Generated epub files
examples/*.epub
*.epub

# Emacs temp files
*~
Expand Down Expand Up @@ -117,4 +117,4 @@ ENV/
# mypy
.mypy_cache/

add_spell.sh
add_spell.sh
29 changes: 21 additions & 8 deletions docs/character_files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,29 @@ standard 5e rules, and are case-insensitive. Refer to the D&D
Character Portrait
==================

.. code:: python
The *portrait* and *symbol* variables in the user character python
file can be set to a filepath (str) of a corresponding image file.

The images generated are centered around an anchor-point where they
are allowed to expand up to a maximum value while keeping their aspect
ratio.

**Custom images** can be inserted with arbitrary location and
dimensions at an arbitrary page. For this, set the *images* list to a
list of **(path_to_image_file, page_index, x_center_coordinate,
y_center_coordinate, max_width, max_height)**

portrait = True
Image paths can be absolute, or relative to the variable
*source_file_location* (defaults to the same folder as the character
sheet file).

If this is set to True and a corresponding portrait file exists,
the portrait will be added to the character personality sheet.
For now, the file must have a .jpeg extension and be named exactly
the same as the character file. This might not work with every Image size.
ca 550 * 700px seems to be the right format. Anything smaller should work, too.
See the Bard1 example for a demonstration of this feature.
.. code-block:: python
:caption: bard1.py
images = [("bard1.jpeg", 0, 320, 110, 100, 100)]
portrait = "shifter_2.png"
symbol = "bard1.jpeg"
Ability Scores
==============
Expand Down
Loading

0 comments on commit 11bd8b3

Please sign in to comment.