Browse Source
Merge branch 'master' into js/faster-deflate
pull/1574/head
James Jackson-South
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
4 deletions
-
src/ImageSharp/ImageExtensions.cs
|
|
|
@ -103,14 +103,18 @@ namespace SixLabors.ImageSharp |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Returns a Base64 encoded string from the given image.
|
|
|
|
/// The result is prepended with a Data URI <see href="https://en.wikipedia.org/wiki/Data_URI_scheme"/>
|
|
|
|
/// <para>
|
|
|
|
/// <example>
|
|
|
|
/// For example:
|
|
|
|
/// <see href="data:image/gif;base64,R0lGODlhAQABAIABAEdJRgAAACwAAAAAAQABAAACAkQBAA=="/>
|
|
|
|
/// </example>
|
|
|
|
/// </para>
|
|
|
|
/// </summary>
|
|
|
|
/// <example><see href="data:image/gif;base64,R0lGODlhAQABAIABAEdJRgAAACwAAAAAAQABAAACAkQBAA=="/></example>
|
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
|
/// <param name="source">The source image</param>
|
|
|
|
/// <param name="format">The format.</param>
|
|
|
|
/// <returns>The <see cref="string"/></returns>
|
|
|
|
public static string ToBase64String<TPixel>(this Image<TPixel> source, IImageFormat format) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
public static string ToBase64String(this Image source, IImageFormat format) |
|
|
|
{ |
|
|
|
using var stream = new MemoryStream(); |
|
|
|
source.Save(stream, format); |
|
|
|
|