Docs
You can use examples below to check how DummyJSON works.
Image
The base URL is: dummyjson.com/image
Generate square image
The URL is: dummyjson.com/image
// https://jsonexamples.com/image/SIZE fetch('https://jsonexamples.com/image/150') .then(response => response.blob()) // Convert response to blob .then(blob => { console.log('Fetched image blob:', blob); }) // Blob {size: SIZE, type: 'image/png'}
Generate image with custom width / height
The URL is: jsonexamples.com/image
// https://jsonexamples.com/image/WIDTHxHEIGHT fetch('https://jsonexamples.com/image/200x100') .then(response => response.blob()) // Convert response to blob .then(blob => { console.log('Fetched image blob:', blob); }) // Blob {size: SIZE, type: 'image/png'}
Generate image with custom text
The URL is: jsonexamples.com/image
// https://dummyjson.com/image/SIZE/?text=TEXT fetch('https://dummyjson.com/image/400x200/008080/ffffff?text=Hello+Peter') .then(response => response.blob()) // Convert response to blob .then(blob => { console.log('Fetched image blob:', blob); }) // Blob {size: SIZE, type: 'image/png'}
Generate image with custom background color
The URL is: dummyjson.com/image
// https://dummyjson.com/image/SIZE/BACKGROUND fetch('https://dummyjson.com/image/400x200/282828') .then(response => response.blob()) // Convert response to blob .then(blob => { console.log('Fetched image blob:', blob); }) // Blob {size: SIZE, type: 'image/png'}
Generate image with custom background and text color
The URL is: dummyjson.com/image
// https://dummyjson.com/image/SIZE/BACKGROUND/COLOR fetch('https://dummyjson.com/image/400x200/008080/ffffff') .then(response => response.blob()) // Convert response to blob .then(blob => { console.log('Fetched image blob:', blob); }) // Blob {size: SIZE, type: 'image/png'}
Generate image with different image formats
The URL is: dummyjson.com/image
Supported Formats: [png, jpg, webp]
// https://dummyjson.com/image/SIZE/BACKGROUND/COLOR fetch('https://dummyjson.com/image/100?type=webp') .then(response => response.blob()) // Convert response to blob .then(blob => { console.log('Fetched image blob:', blob); }) // Blob {size: SIZE, type: 'image/webp'}
Generate image with custom font family
The URL is: dummyjson.com/image
Supported Formats: [
bitter
,
cairo
,
comfortaa
,
cookie
,
dosis
,
gotham
,
lobster
,
marhey
,
pacifico
,
poppins
,
quicksand
,
qwigley
,
satisfy
,
ubuntu ]
// https://dummyjson.com/image/SIZE/?text=TEXT fetch('https://dummyjson.com/image/400x200/008080/ffffff?text=Hello+Peter!&fontFamily=cookie') .then(response => response.blob()) // Convert response to blob .then(blob => { console.log('Fetched image blob:', blob); }) // Blob {size: SIZE, type: 'image/png'}
Generate image with custom font size
The URL is: dummyjson.com/image
// https://dummyjson.com/image/SIZE/?text=TEXT&fontSize=FONT_SIZE fetch('https://dummyjson.com/image/400x200/008080/ffffff?text=Hello+Peter!&fontSize=16') .then(response => response.blob()) // Convert response to blob .then(blob => { console.log('Fetched image blob:', blob); }) // Blob {size: SIZE, type: 'image/png'}