Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ index.html
assets/js/jquery.min.js
assets/js/index.js
_layouts/*.html
/_layouts/_includes/pitch_deck.html
_includes/conferences.html
_includes/header.html
_includes/social.html
Expand Down
15 changes: 1 addition & 14 deletions _data/foundational_supporters.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
{
"2025": [
"Aman Singh",
"Angela Andrews",
"Carol Willing",
"Hugh Dyar",
"Jeremy Carbaugh",
"Jonathan Banafato",
"Mike Fiedler",
"Ned Batchelder",
"Peter Pinch",
"Savannah Ostrowski",
"Tim Schilling",
"Vance Arocho"
],
"2025": ["Aman Singh", "Angela Andrews", "Carol Willing", "Hugh Dyar", "Jeremy Carbaugh", "Jonathan Banafato", "Mike Fiedler", "Ned Batchelder", "Peter Pinch", "Savannah Ostrowski", "Tim Schilling", "Vance Arocho"],
"2024": [
"Albert Sweigart",
"Angela Andrews",
Expand Down
3 changes: 2 additions & 1 deletion _layouts/_includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ <h3>About us</h3>
<h3>Quick link</h3>
<ul>
<li><a href="/about.html">About Us</a></li>
<li><a href="/events/">Events</a></li>
<li><a href="/bdp-events/">Our Events</a></li>
<li><a href="/sponsored-events/">Sponsored Events</a></li>
<li><a href="/community/">Community</a></li>
<li><a href="/support/">Support</a></li>
</ul>
Expand Down
29 changes: 16 additions & 13 deletions image_resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,59 +18,61 @@ def crop_to_ratio(img, target_ratio):
top = (height - new_height) // 2
return img.crop((0, top, width, top + new_height))


def process_image(file_path, ratio, max_size, format="webp"):
"""Process and overwrite the original image: crop, resize, convert format."""
try:
with Image.open(file_path) as img:
# Crop to target ratio
if ratio:
img = crop_to_ratio(img, ratio)

# Resize to max dimensions
if max_size:
img.thumbnail(max_size)

# convert to webp if no transparency
if format.lower() == "webp" and img.mode != "RGBA":
file_path = os.path.splitext(file_path)[0] + ".webp"
img.save(file_path, "webp", optimize=True, quality=85)
else:
img.save(file_path, optimize=True)

print(f"βœ… Overwritten: {file_path}")
except Exception as e:
print(f"❌ Failed {file_path}: {str(e)}")


def main():
folder = "assets/images"
folder = "assets/images"

# Rules for image types
rules = [
{
"suffix": ["banner", "header"],
"ratio": 16/9,
"ratio": 16 / 9,
"max_size": (1920, 1080), # Min size enforced via cropping
"format": "webp"
"format": "webp",
},
{
"suffix": ["thumb", "profile"],
"ratio": 1/1,
"ratio": 1 / 1,
"max_size": (800, 800),
"format": "webp"
}
"format": "webp",
},
]

for filename in os.listdir(folder):
if filename.lower().endswith(('.jpg', '.jpeg', '.png', '.webp')):
if filename.lower().endswith((".jpg", ".jpeg", ".png", ".webp")):
file_path = os.path.join(folder, filename)

# Apply first rule
matched_rule = None
for rule in rules:
if any(keyword in filename.lower() for keyword in rule["suffix"]):
matched_rule = rule
break

# no cropping, resize to 800x600, convert to webp if no transparency
if not matched_rule:
with Image.open(file_path) as img:
Expand All @@ -79,5 +81,6 @@ def main():

process_image(file_path, **matched_rule)


if __name__ == "__main__":
main()
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ pytest-xprocess
axe-core-python==0.1.0
axe-playwright-python==0.1.4
Pillow==11.2.1

Loading