Plugin.Toolkit.Image 1.1.1

dotnet add package Plugin.Toolkit.Image --version 1.1.1                
NuGet\Install-Package Plugin.Toolkit.Image -Version 1.1.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Plugin.Toolkit.Image" Version="1.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Plugin.Toolkit.Image --version 1.1.1                
#r "nuget: Plugin.Toolkit.Image, 1.1.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Plugin.Toolkit.Image as a Cake Addin
#addin nuget:?package=Plugin.Toolkit.Image&version=1.1.1

// Install Plugin.Toolkit.Image as a Cake Tool
#tool nuget:?package=Plugin.Toolkit.Image&version=1.1.1                

Plugin.Toolkit.Image

NuGet .NET MAUI License: MIT

Platform Platform Platform Platform

Plugin.Toolkit.Image is a .NET MAUI library that provides an enhanced image viewing experience by leveraging native platform capabilities. This approach ensures optimal performance and a seamless user experience. Currently, the library supports Android and features pinch-to-zoom functionality. Future updates will include support for iOS and additional image manipulation features.

Features

  • Native Performance: Utilizes native platform components for optimal performance and smooth interactions.
  • Flexible Caching: Configurable caching options to enhance app performance.
  • Pinch-to-Zoom: Allows users to zoom in and out of images using the familiar pinch gesture.
  • Take Image From Camera:
  • Pick Image From Gallery:
  • Cross-Platform (Future): Designed to be cross-platform, with upcoming support for iOS.
  • Extensible: Built with extensibility in mind, making it easy to add new features and customizations.
  • Demo Project: Includes a demo project to get you started

Prerequisites

  • .NET SDK 8.0 or later

Installation

You can install the plugin via NuGet:

Install-Package Plugin.Toolkit.Image

Usage

Register:

In your `MauiProgram.cs` file:
 using Plugin.Toolkit.Image; // <-- add this

 public static class MauiProgram
 {
     public static MauiApp CreateMauiApp()
     {
         var builder = MauiApp.CreateBuilder();
         builder
             .UseMauiApp<App>()
             .UseImageToolkit() // <-- add this
             .ConfigureFonts(fonts =>
             {
	            fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
	            fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
             });

         return builder.Build();
     }
 }

Using Local Image:

 string imagePath = "dotnet_bot.png";
 ImageToolkit.FromLocal(imagePath);

Using Url:

 string imagePath = "https://example.com/image";
 ImageToolkit.FromUrl(imagePath, ImageToolkit.CacheType.Disk);

Using Base64:

 string base64 = "data:image/png;base64,iVBORw0KGgoAAAANSU....";
 ImageToolkit.FromBase64(base64);

Take Image From Camera:

 ImageToolkit imageToolkit = new ImageToolkit();
 var imgStream = await imageToolkit.ImageRequest.TakeImage();
 image_sources.Source = ImageSource.FromStream(() => imgStream);

Take Image From Camera With Resize:

 ImageToolkit imageToolkit = new ImageToolkit();
 var imgStream = await imageToolkit.ImageRequest.TakeImage(new TakePickOptions()
 {
     Height = 1280,
     Width = 720
 });
 image_sources.Source = ImageSource.FromStream(() => imgStream);

Pick Image From Gallery:

 ImageToolkit imageToolkit = new ImageToolkit();
 var imgStream = await imageToolkit.ImageRequest.PickImage();
 image_sources.Source = ImageSource.FromStream(() => imgStream);

Take Image From Camera As Base64:

 ImageToolkit imageToolkit = new ImageToolkit();
 string base64 = await imageToolkit.ImageRequest.TakeImageAsBase64();

Pick Image From Gallery As Base64:

 ImageToolkit imageToolkit = new ImageToolkit();
 string base64 = await imageToolkit.ImageRequest.PickImageAsBase64();

Example Project

The repository includes a sample MAUI project demonstrating the usage of the plugin. You can find it in the samples directory.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Contact

If you have any questions or suggestions, please feel free to contact me at andyapin@gmail.com

Product Compatible and additional computed target framework versions.
.NET net8.0-android34.0 is compatible.  net8.0-ios18.0 is compatible.  net8.0-windows10.0.19041 is compatible.  net9.0-android was computed.  net9.0-ios was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 100 12/25/2024
1.1.0 89 12/24/2024
1.0.0 91 12/18/2024