Skip to content

Commit a36e90d

Browse files
committed
feat: setup exif for images (for credits reasons)
1 parent e88f1ee commit a36e90d

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

77 Bytes
Loading
830 Bytes
Binary file not shown.

src/charts/base.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
from typing import Optional
55

66
import matplotlib.pyplot as plt
7+
from PIL import Image
8+
from PIL.PngImagePlugin import PngInfo
79

810
from src.data_loader import DataLoader
911
import config
@@ -66,8 +68,19 @@ def save(self, fig: Optional[plt.Figure] = None) -> Path:
6668
)
6769
plt.close(fig)
6870

71+
self._add_metadata()
72+
6973
return self.output_path
7074

75+
def _add_metadata(self) -> None:
76+
img = Image.open(self.output_path)
77+
metadata = PngInfo()
78+
metadata.add_text("Author", "github.com/BMOit")
79+
metadata.add_text("Title", self.title)
80+
metadata.add_text("Software", "UIDAI Data Hackathon 2026")
81+
metadata.add_text("Copyright", "github.com/BMOit")
82+
img.save(self.output_path, pnginfo=metadata)
83+
7184
def _apply_common_style(self, ax: plt.Axes) -> None:
7285
ax.set_title(self.title, fontsize=14, fontweight="bold", pad=15)
7386
ax.spines["top"].set_visible(False)

0 commit comments

Comments
 (0)