apyhub-logo

Extract Image Metadata API

30 atoms
Base tier

About

This Utility API lets you fetch the metadata of the image such as height, width, size, format, quality and so on.
You can use the image metadata to edit the size of the image, crop the image, or compress the image.
Extracting metadata from an image can provide several other benefits, including identification, copyright protection, organization, data analysis, and preservation. It can help to identify and provide context for the image, organize images more effectively, analyze trends and patterns, and preserve the image for future use. Metadata can also be used for data analysis, such as tracking the popularity of certain types of images or analyzing trends over time.
Select API Endpoints
Input

API Playground

API Documentation

input file
POST
https://api.apyhub.com/processor/image/metadata/file

Request example

1
curl --location --request POST 'https://api.apyhub.com/processor/image/metadata/file' \
2
--header 'apy-token: {{token}}' \
3
--form 'image=@"stock-photo.jpg"'
Method: POST
Content Type: multipart/form-data
Request Body
AttributeTypeMandatoryDescription
imageFileYesthe source image file
Response
AttributeTypeDescription
data.BitDepthIntegerThe bit depth of the image
data.ColorTypeStringThe color type of the image
data.CompressionStringThe compression type for the image
data.DirectoryStringThe directory for the image (not relevant)
data.ExifToolVersionDecimalThe exif version
data.FileAccessDateStringThe timestamp when the file was accessed
data.FileInodeChangeDateStringThe timestamp for the change date
data.FileModifyDateStringThe timestamp when the file was modified
data.FilePermissionsStringThe permissions for the file (linux type)
data.FileSizeStringThe file size
data.FileTypeStringThe file type
data.FileTypeExtensionStringThe file extension
data.FilterStringThe filter for the image
data.ImageHeightIntegerThe height of the image
data.ImageWidthIntegerThe width of the image
data.ImageSizeStringThe height and the width of the image
data.InterlaceStringThe interlace for the image
data.MIMETypeStringThe mime type of the image
data.MegapixelsStringImage megapixels
data.SRGBRenderingStringThe SRGBRendering for the image
data.SourceFileStringThe Source file information
Sample Response
1
{
2
"data": {
3
"BitDepth": 8,
4
"ColorType": "RGB with Alpha",
5
"Compression": "Deflate/Inflate",
6
"Directory": ".",
7
"ExifToolVersion": 12.5,
8
"FileAccessDate": "2022:12:01 21:30:27+00:00",
9
"FileInodeChangeDate": "2022:12:01 21:30:27+00:00",
10
"FileModifyDate": "2022:12:01 21:30:27+00:00",
11
"FileName": "",
12
"FilePermissions": "-rw-r--r--",
13
"FileSize": "1257 kB",
14
"FileType": "PNG",
15
"FileTypeExtension": "png",
16
"Filter": "Adaptive",
17
"ImageHeight": 2652,
18
"ImageSize": "1920x2652",
19
"ImageWidth": 1920,
20
"Interlace": "Noninterlaced",
21
"MIMEType": "image/png",
22
"Megapixels": 5.1,
23
"SRGBRendering": "Perceptual",
24
"SourceFile": ""
25
}
26
}

HTTP Response Codes

The method may return one of the following HTTP status codes:
Status CodeDescription
200The request was successful.
401Required authentication information is either missing or not valid for the resource.
400Invalid input - the image file is corrupt.
500If any unexpected error occurs while processing the request.

Authentication

All API requests to ApyHub services need to be authenticated. Currently we support tokens or basic authentication mechanisms. You can generate and view your existing credentials from your workspace settings (on the left side of the navbar) and go to “API Keys".
Points to note:
  • Credential secrets are generated on the fly and are not stored in plain text, so on generating a credential please save the secrets somewhere safe.
  • Use the apy-token as the header parameter to pass the token.
  • Use the Authorization header to send the basic authentication credentials.

Error codes

1
{
2
"error": {
3
"code": 105,
4
"message": "Invalid URL"
5
}
6
}
To search for a specific error code, enter the code in the search box below. Alternatively, you can click on the button to view a complete list of all error codes.