SnapKeeper

A single-page web application for searching, viewing, and saving images with integrated face detection capabilities. Users can search for images, view them in a modal, save them to browser cache, and analyze saved images for faces with detection highlights.

Technologies Used

Frontend

  • HTML5
  • CSS3
  • Vanilla JavaScript
  • ES6 Modules

APIs & Libraries

  • Pixabay API
  • MediaPipe Face Detection
  • Cache API

Tools

  • Fetch API
  • Promises
  • Async/Await
  • URL API
  • Blob Objects
SnapKeeper main interface

Challenges & Solutions

Challenge 1: Image Caching Implementation

Implementing a robust caching system for saving images locally while maintaining their metadata and handling blob URLs across different application states.

Solution Approach

Utilized the Cache API to store image blobs locally, converted images to JSON strings for cache indexing, and implemented URL.createObjectURL for displaying cached images while tracking the relationship between original and new blob URLs.

Challenge 2: Face Detection Integration

Integrating the MediaPipe face detection API to analyze saved images and display detection results with appropriate visual feedback.

Solution Approach

Leveraged MediaPipe's face detection model to analyze saved images, created dynamic overlay elements to highlight detected faces, and displayed confidence scores for each detection.

Challenge 3: Asynchronous Operations Management

Managing multiple asynchronous operations when fetching images, processing blobs, and updating the UI while maintaining a smooth user experience.

Solution Approach

Implemented a structured approach to handle multiple asynchronous operations by combining Promise.all for parallel image fetching, async/await for sequential operations, and proper error handling to maintain UI responsiveness and provide user feedback throughout the process.

Outcomes & Results

Created a fully functional single-page web application that allows users to search for images, view them in detail, save them locally using the browser's Cache API, and analyze saved images for faces with real-time detection visualization.

Key Learnings

  • Gained deeper understanding of browser caching mechanisms and the Cache API
  • Learned how to work with blob objects and object URLs for dynamic image handling
  • Implemented AI-based face detection in a web application using MediaPipe
  • Improved skills in asynchronous JavaScript with Promises and async/await
  • Enhanced ability to build responsive single-page applications with vanilla JavaScript

Project Gallery

Demo of SnapKeeper's image search and face detection features

Project Duration

4 weeks

What's Next?

Plan to enhance the application with additional image filtering options, multiple face detection capabilities, and social sharing features.