Find out about the latest from Cloudmersive.

API Spotlight: Image Information APIs
4/14/2023 - Brian O'Neill

Image files contain a wealth of important information within their file structure. If we’re using images for any downstream operation – whether that be related to image editing, sharing, or even digital forensics – retrieving this information is often a key first step in the process. We can retrieve image metadata, which most importantly provides structural information about the file’s visual content (such as its width, height, etc.), and we can additionally retrieve image color data, which yields information about the dominant color values stored in each pixel within the image.

Cloudmersive Image Information APIs execute simple Post requests on image file uploads and return key information about them in a highly structured format. Below, I’ll dive into both Image Information APIs in a bit more detail.

Return the Image Metadata (Including EXIF and Resolution)

As mentioned above, the most basic and broadly useful metadata we can get from an image file is related to its "physical" dimensions (i.e., the height and width of the image). This data is critical for common operations - such as resizing images - which are often carried out to improve the loading speeds of media-rich pages on a website. Naturally, this API returns much more information than just height and width, however; it will additionally provide the following information:

  • IsValidImage – a Boolean declaring the validity of the image file
  • FileFormat – a string declaring the specific format of the file in question
  • BitDepth – an integer describing the number of bits used to represent each pixel in an image
  • HasTransparency – a Boolean declaring if the image contains transparency features
  • ColorSpace – a string describing the range of colors in the image
  • ExifProfileName – a string declaring the name of the Exif Profile (if available)
  • ExifValues – an array of Exif data (if available) including the Tag (string), DataType (string), and DataValue (string)

Please note that Exif data can be easily removed from an image by its original creator, so this information may not be available in every request.

Each request for this API requires only the input image file for the operation; common file formats such as PNG, JPG are supported.

Return the Dominant Colors of the Image

Each color image contains a wide range of color data in its pixels, and there are always certain colors which are more prevalent than others. This API simply retrieves the top 5 dominant colors from an uploaded image and returns them in a DominantColors data array. This operation is especially useful if you’re trying to invert or negate the colors in an image to create a special effect (or reduce file size). Each input request should contain a valid image file in a common format such as PNG or JPG.

For more information on Cloudmersive Image Information APIs, please do not hesitate to reach out to a member of our sales team.

800 free API calls/month, with no expiration

Get started now! or Sign in with Google

Questions? We'll be your guide.

Contact Sales