DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Coding
  3. Java
  4. How To Build a Google Photos Clone - Part 1

How To Build a Google Photos Clone - Part 1

Want to know how to implement a complex web application like Google Photos? Learn how in this video series.

Marco Behler user avatar by
Marco Behler
CORE ·
Dec. 12, 22 · Tutorial
Like (1)
Save
Tweet
Share
4.74K Views

Join the DZone community and get the full member experience.

Join For Free

Ever wanted a sneak peek into how a web application like Google Photos is built from the ground up?

Then let's re-implement (some of) its functionality with Java and, along the way, discuss not only the "how" but also the "why" we are implementing things a certain way. 

Part 1: Generating thumbnails for a directory of photos with Java and ImageMagick, which will serve as the basis for our photo backend service.

What’s in the Video

There are many ways to tackle a complex piece of software like Google Photos, but I'd like to start with a throwaway, spike dummy project and focus on generating thumbnails in this video.

(Quick Note: As always, you'll find all the sources I'm working with on GitHub so that you can follow along easily.)

While Java has an Image API, it is rather limited and we need something more advanced. In comes, the ImageMagick library, which can convert more than 200 different image file formats, extract thumbnails and much more - in short, everything we need for this video.

First off, you'll need to install ImageMagick and I'll show you the most painless way to do so, by using a package manager. You can then proceed to clone the sample images project and the project skeleton I am working with, to start converting a couple of test images.

After having opened the dummy project in your IDE, we can finally start coding. I will be using JetBrain's Fleet IDE throughout the video series, but any IDE with basic Maven support will work.

First, we'll need to tackle creating a thumbnail. On the command line, it is relatively easy to call ImageMagick, to dynamically resize images to a certain width and height. Hence, our challenge is to use Java's Process API to spawn external ImageMagick processes and also to make sure they shut down gracefully, i.e. not hang around forever whenever a problem occurs.

Once we can extract thumbnails from single images, up next is extracting thumbnails for whole directories. That means using Java's Path API to walk a whole file tree, including its subdirectories, filtering out the images and then feeding them to multiple, sequential ImageMagick processes. Along the way, we need to figure out how to decide which file is an image and how a corresponding isImage() method could be implemented.

Let's take a short break and reflect on what we did so far. It is not the best and the most bullet-proof code ever written, but we have something working! And that's what's important for now - having a working version pretty soon, instead of debating endlessly over architectural decisions we don't need to solve right now.

Hence, we're going to take our application and deploy it to a local Linux NAS - as I developed everything on a Windows machine and I want to see stuff work on Linux as well. The problem is: As soon as we execute our app on the NAS, it fails and no images are being generated. Why? The NAS had Java and ImageMagick installed? 

You'll find out in the next episode.


Requirements engineering Web application application Build (game engine) Clone (Java method) Directory Google (verb) Java (programming language) Peek (software)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Multi-Cloud Integration
  • Steel Threads Are a Technique That Will Make You a Better Engineer
  • Container Security: Don't Let Your Guard Down
  • The Path From APIs to Containers

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: