Dev

Six APIs for placeholder images and profile avatars

Choose a placeholder image API for avatars, feed thumbnails, wireframes, or domain icons, with sample URLs that keep test layouts easy to reproduce.

Six APIs for placeholder images and profile avatars

I use placeholder image endpoints to test avatar sizes, thumbnails, and card layouts before the application has real uploads. The choice depends on whether the test needs a predictable identity, a named image size, or a realistic photograph.

DiceBear for repeatable illustrated avatars

DiceBear lets you choose a style and pass a seed. A fixed style, API version, and seed yield a repeatable avatar, which is useful when a profile image should stay recognizable across a list view and a detail page. I use a stable, non-sensitive fixture ID as the seed because the URL goes to a third-party service.

Request pattern https://api.dicebear.com/9.x/{style}/{svg|png}?seed={seed}

StyleTypical useExample
LoreleiIllustrated portrait for a member profileOpen sample
BotttsRobot illustration for a service accountOpen sample
AvataaarsCasual flat portrait for a communityOpen sample
NotionistsMonochrome illustration for a simpler interfaceOpen sample
IdenticonGeometric identifier badgeOpen sample
InitialsText initials in a compact avatarOpen sample

A profile without a user upload can use a generated default. In this Kotlin example the user ID is an opaque test identifier. With a production user model, check what can be disclosed, or generate and store the fallback within the application.

1
2
3
4
5
6
7
data class User(
    val id: java.util.UUID,
    val email: String,
    val nickname: String,
    // Use a stable avatar for a test user without a profile image
    val profileImageUrl: String = "https://api.dicebear.com/9.x/lorelei/svg?seed=$id"
)

SVG works well when the image scales across layouts. PNG is useful for consumers that need a raster format. Options such as backgroundColor=b6e3f4,c0aede and radius=50 control the background and shape.

UI Avatars and Pravatar for simpler profiles

UI Avatars turns a name into an initials badge. It supports a rounded image, custom background and text colors, and a bold text option. It can also derive an initial from Korean names. Use URL encoding for names with spaces or non-ASCII characters.

VariantExample
Default English initialsOpen sample
Round with a random backgroundOpen sample
Korean initial with explicit colorsOpen sample

Pravatar uses photographs of people. It is handy when I want to inspect how a circular crop handles a real portrait. A request such as https://i.pravatar.cc/250 picks a sample photo. A fixed img value, such as this request with ID 12, keeps the same image across runs. A stable image makes regressions in alignment or crop easier to spot.

Lorem Picsum for photos and thumbnails

Lorem Picsum provides photos at the dimensions in the URL. I use it for feed cards, product grid mockups, and gallery thumbnails, where a realistic image makes it easier to judge spacing.

RequestResult
250 × 160A random landscape thumbnail
160 × 160A random square thumbnail
ID 237 at 250 × 160A specific photo, in this case a dog
Seed spring at 250 × 160A photo selected by a stable seed

Add ?grayscale for a black-and-white image or ?blur to inspect how the card reads with a blurred image. When comparing layout screenshots, fix the ID or seed so that the next request represents a layout change instead of a different photo.

Placehold.co for wireframes

Placehold.co produces simple blocks, with dimensions displayed by default. A labeled block comes in handy when I need to reserve the right space for an ad slot, hero banner, or card image before the final crop is known.

VariantExample
Dimension label240 × 120
Custom label and PNGMain Banner
Dark theme colorsCard View

Use a path in the form /{width}x{height}/{backgroundColor}/{textColor}. Background and foreground colors take hex values without #. SVG is the default, and the format can be specified for clients that require PNG, WebP, or JPG.

A link preview, partner list, or login-provider picker sometimes needs a small icon associated with a domain. Google’s favicon endpoint accepts a domain and pixel size, for example https://www.google.com/s2/favicons?domain=github.com&sz=128. Here are equivalent requests for Google, Naver, and Apple.

I use that endpoint for familiar icons in a mockup. A favicon can be low-resolution or missing even when the request asks for a larger size, so provide a default. Logo.dev is another option when the project can supply its required token. Keep domain lookups separate from any private partner records.

Pick an endpoint by the layout you need to test

Test fixtureEndpointUseful property
Illustrated member avatarDiceBearRepeatable style and seed
Initials badgeUI AvatarsFits a small, text-based profile
Photographic profilePravatarCan select a stable sample
Feed or product thumbnailLorem PicsumCustom dimensions and fixed ID or seed
Wireframe or banner slotPlacehold.coShows the expected dimensions or label
Domain iconGoogle favicon endpointAccepts the public domain as a query

For interactive mockups, it is convenient to open the URLs and compare them as you work. For screenshot tests and other repeatable checks, use a local copy of the exact fixture with an appropriate license, or generate a local placeholder so the test does not depend on a live service.

This post is licensed under CC BY 4.0 by the author.