Skip to main content

image-info


Use the image-info endpoint to get metadata from an image.

The image-info endpoint takes an HTTP POST form submission, where an image is sent as binary.

Run In Postman

API

The ImageInfo class encapsulates the image-info endpoint. An ImageInfo instance takes an ImageResource instance. An ImageResource is constructed from an image coming from a file, a byte array, or Stream.

public ImageInfo(ImageResource resource);

public class ImageResource : Resource
{
public ImageResource(string filePath, string resourceName = null);
public ImageResource(byte[] value, string resourceName = null);
public ImageResource(Stream data, string resourceName = null);
}
Source: ImageInfo.cs Source: ImageResource.cs

Example

info

Refer to the following Users Guide page if you need more information illustrating how to call the endpoint directly as a REST call.

The complete example is available via one of the following GitHub projects depending upon the language you wish to use.

LanguageGitHub Users Guide ProjectClassLocation/Package/Namespace
C#https://github.com/dynamicpdf-api/dotnet-client-examplesImageInfoExample.csnamespace Users_Guide_C_Sharp
Gohttps://github.com/dynamicpdf-api/go-clientimage-info-example.gogo-client-examples
Javahttps://github.com/dynamicpdf-api/java-client-examplesImageInfoExample.javacom.dynamicpdf.api.examples
Node.jshttps://github.com/dynamicpdf-api/nodejs-client-examplesImageInfoExample.jsnode-js-users-guide
PHPhttps://github.com/dynamicpdf-api/php-client-examplesImageInfoExample.phpphp-client-examples
Pythonhttps://github.com/dynamicpdf-api/python-client-examplesImageInfoExample.pypython-client-examples

For all six languages the syntax and logic is similar.

  • Create a new ImageResource instance that holds the path to the image.
  • Create a new ImageInfo instance that holds the resource and then calls the endpoint.
  • The endpoint then returns the image metadata as a JSON document.
using DynamicPDF.Api;
using System;

namespace ImageInfoExample
{
class Program
{
static void Main(string[] args)
{
RunOne("DP.xxx-api-key-xxx", "C:/temp/dynamicpdf-api-usersguide-examples/");
RunTwo("DP.xxx-api-key-xxx", "C:/temp/dynamicpdf-api-usersguide-examples/");
}

public static void RunOne(String key, String basePath)
{
ImageResource imageResource = null;
imageResource = new ImageResource(basePath + "getting-started.png");
ImageInfo imageInfo = new ImageInfo(imageResource);
imageInfo.ApiKey = key;
ImageResponse response = imageInfo.Process();
Console.WriteLine(PrettyPrintUtil.JsonPrettify(response.JsonContent));
}

public static void RunTwo(String apiKey, String basePath)
{
String key = apiKey;
ImageResource imageResource = new ImageResource(basePath + "multipage.tiff");
ImageInfo imageInfo = new ImageInfo(imageResource);
imageInfo.ApiKey = apiKey;
ImageResponse response = imageInfo.Process();
Console.WriteLine(PrettyPrintUtil.JsonPrettify(response.JsonContent));
}

}
}
Source: ImageInfoExample
   Follow us on social media for latest news!