Retrieve Image Information
Extract image information from an image using the image-info endpoint.
Extracting image information from the image-info
endpoint is a breeze using DynamicPDF API. Refer to our documentation illustrating calling the endpoint directly (image-info) and using one of our client libraries.
tip
Check out Getting Started and Task Roadmap if you are new to The DynamicPDF API.
info
Refer to the API documentation and the client library documentation for the image-info
endpoint.
Calling Endpoint Directly
curl --location 'https://api.dynamicpdf.com/v1.0/image-info'
--header 'Authorization: Bearer DP--api-key--'
--header 'Content-Type: image/png'
--data '@/C:/temp/solutions/image-info/dynamicpdfLogo.png'
Calling Endpoint Using Client Library
- C# (.NET)
- Java
- Node.js
- PHP
- Go
- Python
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));
}
}
}
import {
ImageResource,
ImageInfo,
} from "@dynamicpdf/api"
export class ImageInfoExample {
static async Run() {
var basePath = "C:/temp/dynamicpdf-api-usersguide-examples/";
var apiKey = "DP.xxx-api-key-xxx";
await ImageInfoExample.RunOne(apiKey, basePath);
await ImageInfoExample.RunTwo(apiKey, basePath);
}
static async RunOne(apiKey, basePath) {
var imageResource = new ImageResource(basePath + "getting-started.png");
var imageInfo = new ImageInfo(imageResource);
imageInfo.apiKey = apiKey;
var response = await imageInfo.process();
if (response.isSuccessful) {
console.log(JSON.parse(response.content));
}
}
static async RunTwo(apiKey, basePath)
{
var imageResource = new ImageResource(basePath + "multipage.tiff");
var imageInfo = new ImageInfo(imageResource);
imageInfo.apiKey = apiKey;
var response = await imageInfo.process();
if (response.isSuccessful) {
console.log(JSON.parse(response.content));
}
}
}
await ImageInfoExample.Run();
package com.dynamicpdf.api.examples;
import com.dynamicpdf.api.ImageInfo;
import com.dynamicpdf.api.ImageResource;
import com.dynamicpdf.api.ImageResponse;
import com.dynamicpdf.api.util.PrettyPrintUtility;
public class ImageInfoExample {
package com.dynamicpdf.api.examples;
import com.dynamicpdf.api.ImageInfo;
import com.dynamicpdf.api.ImageResource;
import com.dynamicpdf.api.ImageResponse;
import com.dynamicpdf.api.util.PrettyPrintUtility;
public class ImageInfoExample {
public static void RunOne(String key, String basePath) {
ImageResource imageResource = null;
imageResource = new ImageResource(basePath + "/getting-started.png");
ImageInfo imageInfo = new ImageInfo(imageResource);
imageInfo.setApiKey(key);
ImageResponse response = imageInfo.process();
System.out.println(PrettyPrintUtility.prettyPrintJSON(response.getJsonContent()));
}
public static void RunTwo(String apiKey, String basePath)
{
String key = apiKey;
ImageResource imageResource = new ImageResource(basePath + "/multipage.tiff");
ImageInfo imageInfo = new ImageInfo(imageResource);
imageInfo.setApiKey(apiKey);
ImageResponse response = imageInfo.process();
System.out.println(PrettyPrintUtility.prettyPrintJSON(response.getJsonContent()));
}
public static void main(String[] args) {
ImageInfoExample.RunOne("DP.xxx-api-key-xxx",
"C:/temp/dynamicpdf-api-usersguide-examples/");
ImageInfoExample.RunTwo("DP.xxx-api-key-xxx",
"C:/temp/dynamicpdf-api-usersguide-examples/");
}
}
public static void main(String[] args) {
ImageInfoExample.RunOne("DP.xxx-api-key-xxx",
"C:/temp/dynamicpdf-api-usersguide-examples/");
ImageInfoExample.RunTwo("DP.xxx-api-key-xxx",
"C:/temp/dynamicpdf-api-usersguide-examples/");
}
}
<?php
require __DIR__ . '/vendor/autoload.php';
use DynamicPDF\Api\ImageResource;
use DynamicPDF\Api\ImageInfo;
class ImageInfoExample
{
private static string $BasePath = "C:/temp/dynamicpdf-api-usersguide-examples/";
private static string $ApiKey = "DP.xxx-api-key-xxx";
public static function Run(){
ImageInfoExample::RunOne();
ImageInfoExample::RunTwo();
}
public static function RunOne()
{
$imageResource = new ImageResource(ImageInfoExample::$BasePath . "getting-started.png");
$imageInfo = new ImageInfo($imageResource);
$imageInfo->ApiKey = ImageInfoExample::$ApiKey;
$response = $imageInfo->Process();
echo ($response->JsonContent);
}
public static function RunTwo()
{
$imageResource = new ImageResource(ImageInfoExample::$BasePath . "multipage.tiff");
$imageInfo = new ImageInfo($imageResource);
$imageInfo->ApiKey = ImageInfoExample::$ApiKey;
$response = $imageInfo->Process();
echo ($response->JsonContent);
}
}
ImageInfoExample::Run();
package main
import (
"fmt"
"github.com/dynamicpdf-api/go-client/endpoint"
"github.com/dynamicpdf-api/go-client/resource"
)
func RunOne(basePath string) {
resource := resource.NewImageResourceWithResourcePath(basePath + "/getting-started.png","")
imageInfo := endpoint.NewImageInfo(resource)
imageInfo.Endpoint.BaseUrl = "https://api.dynamicpdf.com/"
imageInfo.Endpoint.ApiKey = "DP.xxx-api-key-xxx"
resp := imageInfo.Process();
res := <-resp
if res.IsSuccessful() == true {
fmt.Print(string(res.Content().Bytes()))
}
}
func RunTwo(basePath string) {
resource := resource.NewImageResourceWithResourcePath(basePath + "/multipage.tiff","")
imageInfo := endpoint.NewImageInfo(resource)
imageInfo.Endpoint.BaseUrl = "https://api.dynamicpdf.com/"
imageInfo.Endpoint.ApiKey = "DP.xxx-api-key-xxx"
resp := imageInfo.Process();
res := <-resp
if res.IsSuccessful() == true {
fmt.Print(string(res.Content().Bytes()))
}
}
func main() {
RunOne("C:/temp/dynamicpdf-api-samples/image-info")
RunTwo("C:/temp/dynamicpdf-api-usersguide-examples/image-info")
}
from dynamicpdf_api.image_resource import ImageResource
from dynamicpdf_api.image_info import ImageInfo
from Shared import *
def image_info(api_key, full_path):
resource = ImageResource(full_path + "getting-started.png")
image_info = ImageInfo(resource)
image_info.api_key = api_key
response = image_info.process()
print(response.json_content)
if __name__ == "__main__":
image_info(api_key, base_path + "/image-info/")