Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thumbnail Count API #10

Open
SkyeHoefling opened this issue Sep 3, 2021 · 0 comments
Open

Thumbnail Count API #10

SkyeHoefling opened this issue Sep 3, 2021 · 0 comments
Assignees
Labels
⚒ Enhancement New feature or request good first issue Good for newcomers 🏁 ready-for-dev

Comments

@SkyeHoefling
Copy link
Contributor

SkyeHoefling commented Sep 3, 2021

Description

Add thumbnail count API to determine how many thumbnail images if any are embedded in the heic image

New APIs

IHeifImage

// Gets the number of thumbnails embedded in the heif file
// this is typically 0 or 1
int GetThumbnailCount(); // New API

// Gets an array of all available thumbnail ids, if 0 
// then the image doesn't have any thumbnails
int[] GetThumbnailIds(); // New API

// Gets the thumbnail at the specified ID
IImage Thumbnail(int id); // New API

Usage

The code snippet below will write all thumbnails to disk

using (var image = new HeifImage("MyImage.heic"))
{
  int[] thumbnailIds = image.GetThumbnailIds();
  for (int i = 0; i , thumbnailIds.Length; i++)
  {
    using (var thumbnail = image.GetThumbnail(thumbnailIds[i]))
    {
        thumbnail.Write($"output_{i}.jpeg", 90);
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚒ Enhancement New feature or request good first issue Good for newcomers 🏁 ready-for-dev
Projects
None yet
Development

No branches or pull requests

2 participants