Get full-size image URLs and dimensions from a Google image search API
A Google image search API is what you need when the answer to a query is a picture: each result comes back with the full-resolution image URL, its width and height, a thumbnail, the page it came from, and the creator or credit when Google shows one. Content teams source visuals, catalogs find product shots and dataset builders collect examples by keyword. The Search API returns them as JSON.
Image results give you thumbnails, not the actual image
Image search is built for browsing. The grid shows thumbnails, the full image sits behind a viewer, and the page that published it is one more click away. For a pipeline that needs the original file at a known size, every one of those hops is work.
Scraping the image grid yourself gets you cached thumbnails and encoded links to the originals, loaded lazily as the page scrolls. Resolving each one to the real file and measuring it means downloading every candidate before you know whether it is big enough to use.
type: images returns each result with image.url, image.width and image.height for the full-resolution file, a thumbnail with its own dimensions, url for the source page, and creator and credit when available. You filter by size and aspect ratio before downloading anything, then read the source page only for the images you keep.
How to find full-size images with the Google image search API
Search by keyword, keep the images that fit your layout, then check the source before you use one. The images guide documents the result shape.
import createClient from 'microlink.io'
const microlink = createClient({
apiKey: process.env.MICROLINK_API_KEY
})
const { results } = await microlink.search('northern lights iceland', {
type: 'images'
})
const images = results.map(({ title, url, image, thumbnail, creator, credit }) => ({
title,
source: url,
src: image.url,
width: image.width,
height: image.height,
preview: thumbnail.url,
creator,
credit
}))image is the full-resolution file and thumbnail the small preview, each with width and height. url is the page that published the image, where its license terms live.
const wide = results.filter(
({ image }) => image.width >= 1600 && image.width / image.height >= 1.5
)There is no server-side size filter; the dimensions in each result are the filter. This keeps landscape images at least 1600 pixels wide, before any download.
import createClient from 'microlink.io'
const microlink = createClient({
apiKey: process.env.MICROLINK_API_KEY
})
const [pick] = wide
const sourcePage = await pick.markdown()markdown() fetches the page the image came from as Markdown, one request, so you can read the caption, the credit line and the usage terms around it. See content expansion for the HTML variant.
The search takes a text query. It does not accept an image as input, so it does no reverse image search and finds no visually similar images. For moving pictures, the videos surface returns duration, channel and publish date with the same client.
Why image results with dimensions save a download step
Most image pipelines discard most candidates. Knowing the size up front means the rejected ones are never downloaded.
Need a picture of a web page rather than a picture on it? Capture a mobile screenshot at any viewport with the Screenshot API.
Looking for products with prices rather than pictures? Compare prices from Google Shopping, where each listing can carry its product image.
When not to: a search result is not a license. A found image still belongs to its creator, so check the source page before publishing it. And if you want to search by an image rather than for one, this surface does not do reverse image search.
FAQ
Does the Google image search API return full-size image URLs?
Can I filter image search results by size?
Can I do a reverse image search with this API?
Can I publish images found through the image search API?
How much does the image search API cost, and is it affiliated with Google?
Solve the next problem with the same API
Price comparison from Google Shopping
Keyword research with Google Autocomplete
Google results page as Markdown or HTML
Brand colors from images
Fix missing or wrong og:image
Dynamic Open Graph images
Ready to find full-size images?
Full-resolution image URLs with dimensions and attribution as JSON. Get a Pro key and run your first image search today.