Get Image Information from a Slide Introduction
The following API method allows you to easily read information about images placed on a slide in a PowerPoint document. You can find out the following image properties: width, height, type, etc.
GetSlideImages
API
Type
Description
Resource
/slides/{name}/slides/{slideIndex}/images
GET
Returns information about the images placed on a slide.
GetSlideImages
Request Parameters
Name
Type
Location
Required
Description
name
string
path
true
The name of a presentation file.
slideIndex
integer
path
true
The 1-based index of the slide.
password
string
header
false
The password to open the presentation.
folder
string
query
false
The path to the folder containing the presentation.
storage
string
query
false
The name of the storage contaning the folder
.
In case of Amazon S3 storage folder path starts with Amazon S3 bucket name.
Examples
Read information about the images placed on the first slide in MyFolder/MyPresentation.pptx file saved to the default storage.
cURL Solution
Request
Get an Access Token
Copy curl -X POST "https://api.aspose.cloud/connect/token" \
-d "grant_type=client_credentials&client_id=MyClientId&client_secret=MyClientSecret" \
-H "Content-Type: application/x-www-form-urlencoded"
Read Image Information
Copy curl -X GET "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1/images?folder=MyFolder" \
-H "authorization: Bearer <access_token>"
Response
Response Example
Copy {
"list" : [
{
"width" : 1021 ,
"height" : 308 ,
"contentType" : "image/png" ,
"selfUri" : {
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/images/1?folder=MyFolder" ,
"relation" : "self"
},
"alternateLinks" : [
{
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/images/1/jpeg?folder=MyFolder" ,
"relation" : "alternate"
},
{
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/images/1/png?folder=MyFolder" ,
"relation" : "alternate"
},
{
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/images/1/gif?folder=MyFolder" ,
"relation" : "alternate"
}
]
},
{
"width" : 430 ,
"height" : 368 ,
"contentType" : "image/jpeg" ,
"selfUri" : {
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/images/2?folder=MyFolder" ,
"relation" : "self"
},
"alternateLinks" : [
{
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/images/2/jpeg?folder=MyFolder" ,
"relation" : "alternate"
},
{
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/images/2/png?folder=MyFolder" ,
"relation" : "alternate"
},
{
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/images/2/gif?folder=MyFolder" ,
"relation" : "alternate"
}
]
}
],
"selfUri" : {
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1/images?folder=MyFolder" ,
"relation" : "self" ,
"slideIndex" : 1
}
}
SDK Solutions
C#
Copy
using Aspose.Slides.Cloud.Sdk ;
using System.Diagnostics ;
class Application
{
static void Main ( )
{
var slidesApi = new SlidesApi ( "MyClientId" , "MyClientSecret" );
var imagesInfo = slidesApi . GetSlideImages ( "MyPresentation.pptx" , 1 , null , "MyFolder" );
foreach ( var imageInfo in imagesInfo . List )
{
Debug . WriteLine ( $"{imageInfo.Width} x{imageInfo.Height} , {imageInfo.ContentType} " );
}
}
}
Java
Copy
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
public class Application {
public static void main ( String [] args ) throws ApiException {
SlidesApi slidesApi = new SlidesApi ( "MyClientId" , "MyClientSecret" );
Images imagesInfo = slidesApi . getSlideImages ( "MyPresentation.pptx" , 1 , null , "MyFolder" , null );
for ( Image imageInfo : imagesInfo . getList ()) {
System . out . printf ( "%sx%s, %s\n" , imageInfo . getWidth (), imageInfo . getHeight (), imageInfo . getContentType ());
}
}
}
PHP
Copy
use Aspose \Slides \Cloud \Sdk \Api \Configuration ;
use Aspose \Slides \Cloud \Sdk \Api \SlidesApi ;
$configuration = new Configuration ();
$configuration -> setAppSid ( "MyClientId" );
$configuration -> setAppKey ( "MyClientSecret" );
$slidesApi = new SlidesApi ( null , $configuration );
$imagesInfo = $slidesApi -> getSlideImages ( "MyPresentation.pptx" , 1 , null , "MyFolder" );
foreach ( $imagesInfo -> getList () as $imageInfo ) {
echo sprintf ( "%sx%s, %s \n " , $imageInfo -> getWidth (), $imageInfo -> getHeight (), $imageInfo -> getContentType ());
}
Ruby
Copy
require "aspose_slides_cloud"
include AsposeSlidesCloud
configuration = Configuration . new
configuration . app_sid = "MyClientId"
configuration . app_key = "MyClientSecret"
slides_api = SlidesApi . new ( configuration )
images_info = slides_api . get_slide_images ( "MyPresentation.pptx" , 1 , nil , "MyFolder" )
for image_info in images_info . list
puts " #{ image_info . width } x #{ image_info . height } , #{ image_info . content_type } "
end
Python
Copy
import asposeslidescloud
from asposeslidescloud.apis.slides_api import SlidesApi
slides_api = SlidesApi ( None , "MyClientId" , "MyClientSecret" )
images_info = slides_api . get_slide_images ( "MyPresentation.pptx" , 1 , None , "MyFolder" )
for image_info in images_info . list :
print ( f "{image_info.width} x{image_info.height} , {image_info.content_type} " )
Node.js
Copy
const cloud = require ( "asposeslidescloud" );
const slidesApi = new cloud . SlidesApi ( "MyClientId" , "MyClientSecret" );
slidesApi . getSlideImages ( "MyPresentation.pptx" , 1 , null , "MyFolder" ). then ( imagesInfo => {
imagesInfo . body . list . forEach ( imageInfo => {
console . log ( imageInfo . width + "x" + imageInfo . height + ", " + imageInfo . contentType );
});
});
C++
Copy
#include "asposeslidescloud/api/SlidesApi.h"
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = new SlidesApi ( L "MyClientId" , L "MyClientSecret" );
auto imagesInfo = slidesApi -> getSlideImages ( L "MyPresentation.pptx" , 1 , L "" , L "MyFolder" ). get ();
for ( auto imageInfo : imagesInfo -> getList ()) {
std :: wcout << imageInfo -> getWidth () << "x" << imageInfo -> getHeight () << ", " << imageInfo -> getContentType () << std :: endl ;
}
std :: cin . get ();
return 0 ;
}
Perl
Copy
use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
my $config = AsposeSlidesCloud::Configuration -> new ();
$config -> { app_sid } = "MyClientId" ;
$config -> { app_key } = "MyClientSecret" ;
my $slides_api = AsposeSlidesCloud::SlidesApi -> new ( config => $config );
my %parameters = ( name => "MyPresentation.pptx" , slide_index => 1 , folder => "MyFolder" );
my $images_info = $slides_api -> get_slide_images ( %parameters );
for my $image_info ( @ { $images_info -> { list }}) {
print ( "$image_info->{width}x$image_info->{height}, $image_info->{content_type}\n" );
}
Swift
Go
SDKs
Using an SDK (API client) is the quickest way for a developer to speed up development. An SDK takes care of a lot of low-level details of making requests and handling responses and lets you focus on writing code specific to your particular project. Check out our GitHub repository for a complete list of Aspose.Slides Cloud SDKs along with working examples, to get you started in no time. Please check Available SDKs article to learn how to add an SDK to your project.