PlaceMellon

Placeholder images of Carnegie Mellon

About PlaceMellon

PlaceMellon provides CMU photos for mockups and prototypes at the size you need. Inspired by PlaceCats and PlaceBear, it lets you request a placeholder image simply by putting its dimensions in the URL.

Where the Photos Come From

The photos come from CMU Selects, University Communications & Marketing's collection of campus photography. CMU Selects says they're for "use by the Carnegie Mellon University community in university-related communications and marketing," so use PlaceMellon for CMU work. For a finished page, choose and credit a photo there.

The Scotty in ?scotty and ?profile is traced from the avatar of the Scotty chatbot.

Which Photo Is This?

Each image comes with an X-Photo header that names its photo. Look it up with this command, using your image's address, then search for the name in CMU Selects:

curl -sI https://placemellon.andrew.cmu.edu/400/300 | grep -i x-photo

Or open the image in your browser, open its developer tools and find the header under the image's request on the Network tab.

How It Works

PlaceMellon picks a photo shaped like your size: landscape for wide sizes, portrait for tall ones and any photo for sizes close to square. It crops the photo to fit, keeping its most interesting part rather than simply the middle.

  • The same size always gets the same photo.
  • Add ?random for a different photo each time.
  • Scotty stays sharp at any size, since he's drawn from vector shapes.
  • Source photos aren't saved to disk. PlaceMellon fetches each one from CMU Selects when it's needed.

Technical Details

PlaceMellon keeps a list of the CMU Selects photos and refreshes it every few hours. It narrows the list to photos of the right shape, then picks one by rendezvous hashing, scoring each photo by your size and its ID and taking the highest. So when University Communications & Marketing adds or removes photos, nearly every size keeps the photo it had. With ?random, it skips the scoring and picks any photo of the right shape.

To crop, it fetches the smallest preview that covers your size and keeps the part with the most detail and color. It holds recently made images in memory for a short while, and browsers may keep each one for a day, so repeat requests are fast. Random photos are never held.

PlaceMellon is a small TypeScript app built with Express and sharp. The GitHub repository has the code, its tests and documentation. To report a problem or suggest a change, open an issue or send a pull request.

More CMU Web Tools

PlaceMellon is one of three CMU Web projects for building Carnegie Mellon websites and web apps.

Carnegie Mellon Web Kit

Components for websites and web apps on CMU's template.

Visit the Web Kit

Carnegie Mellon Web Markdown

A GitHub Pages theme that turns plain Markdown into pages in CMU style.

Visit Web Markdown