Skip to content

Commit

Permalink
Merge 312ce2d into 4d21d61
Browse files Browse the repository at this point in the history
  • Loading branch information
zmoon committed Jul 12, 2023
2 parents 4d21d61 + 312ce2d commit 1fe95eb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Setuptools SCM version.py file
pydecorate/version.py

# Files created by test run
style_retention.png
add_logo_pytroll.png

### PYTHON IGNORES ###
*.py[cod]
__pycache__/
Expand Down
2 changes: 1 addition & 1 deletion pydecorate/decorator_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def _add_logo(self, logo_path, **kwargs):
nyi = int(round(nxi * aspect))
ny = nyi + 2 * my

logo = logo.resize((nxi, nyi), resample=Image.ANTIALIAS)
logo = logo.resize((nxi, nyi), resample=Image.Resampling.LANCZOS)

# draw base
px = self.style["propagation"][0] + self.style["newline_propagation"][0]
Expand Down
11 changes: 11 additions & 0 deletions pydecorate/tests/test_decorator_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Tests for the aggdraw-based decorator."""

from pathlib import Path
from unittest import mock

import numpy as np
Expand All @@ -27,6 +28,9 @@

from pydecorate import DecoratorAGG

HERE = Path(__file__).parent
REPO = HERE.parent.parent


@pytest.mark.parametrize(
"orientation_func_name", ["write_vertically", "write_horizontally"]
Expand Down Expand Up @@ -66,6 +70,13 @@ def test_colorbar(tmp_path, orientation_func_name, align_func_name, clims):
)


def test_add_logo():
img = Image.fromarray(np.zeros((200, 200, 3), dtype=np.uint8))
dc = DecoratorAGG(img)
dc.add_logo(REPO / "logos/pytroll_light_big.png")
img.save("add_logo_pytroll.png")


def assert_colorbar_increasing_tick_order(draw_text_wrapper) -> None:
last_float_text = None
for call_args in draw_text_wrapper.call_args_list:
Expand Down

0 comments on commit 1fe95eb

Please sign in to comment.