magic.lambda.image 17.2.0

dotnet add package magic.lambda.image --version 17.2.0
NuGet\Install-Package magic.lambda.image -Version 17.2.0
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="magic.lambda.image" Version="17.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add magic.lambda.image --version 17.2.0
#r "nuget: magic.lambda.image, 17.2.0"
#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 magic.lambda.image as a Cake Addin
#addin nuget:?package=magic.lambda.image&version=17.2.0

// Install magic.lambda.image as a Cake Tool
#tool nuget:?package=magic.lambda.image&version=17.2.0

magic.lambda.image - Manipulating and creating images from Hyperlambda

The magic.lambda.image project contains image manipulation functions for Hyperlambda, allowing you to do basic manipulation of images, in addition to generating QR codes. More specifically this project contains the following slot.

  • [image.generate-qr] - Generate a QR code with the specified payload
  • [image.size] - Returns the width and height of the specified image
  • [image.resize] - Resizes the specified image
  • [image.convert] - Converts the specified image to another format
  • [image.crop] - Crops the specified image

Transforming images

All image transformation slots works similarly. They can either be given a string being the relative filename of the image you want to transform, or a stream from where to load the image. All transformation slots can also be given a [type] argument, which is how to return the image after the transformation is done. Supported types are as follows.

  • png
  • jpeg
  • bmp
  • gif
  • tga
  • pbm
  • tiff
  • webp

In addition you can provide a [dest] argument, which if specified, becomes the relative path of where to save the image after transformation has been applied. If not specified, the image will be returned as a stream to caller, otherwise the image will be saved to the specified file.

How to use [image.resize]

Resizing an image can be done as follows.

image.resize:/some-image.png
   height:250
   type:png

The above will resize the specified image to a width of 250 pixel, converting it to PNG, while keeping the aspect ratio by calculating the new height automatically. You can provide either of.

  • [width] - New width
  • [height] - New height

You can provide both of the above, but at least one of the above must be specified. If one of the values are ommitted, it will be calculated by keeping the aspect ratio of the image as is. The [type] argument is how to return the image after the transformation has been applied, and can be any of the supported types as specified above. Notice, the image might be stretched in one direction if you change the existing width and height ratio during the transformation.

How to use [image.crop]

To crop an image you specify the following arguments.

  • [left] - Pixels to remove from the left parts of image
  • [top] - Pixels to remove from the top parts of image
  • [right] - Pixels to remove from the right parts of image
  • [bottom] - Pixels to remove from the bottom parts of image

Notice, left + right must be smaller than the total width of the image, and top + bottom must be smaller than the total height of the image. All arguments are optional, allowing you to only crop an image at one side, such as for instance illustrated below.

image.crop:/modules/test/qr.png
   right:50

How to use [image.convert]

To convert an image from for instance png to jpeg, you can use something such as follows.

image.convert:/some-image.png
   type:jpeg

The above keeps the image as is, except converts it from its existing format to a jpeg image.

How to use [image.generate-qr]

You can use the [image.generate-qr] slot to create a QR code. This slot returns the QR code as a MemoryStream, which allows you to return its output directly over the HTTP response object, which again will persist the QR code back as the response to the caller if you're in a web project of some sort using Magic. The slot takes two arguments.

  • Value of node - Mandatory string, or an expression leading to a string, which is to become the content of the generated QR code
  • [size] - Optional argument declaring the size of your QR code

Below is an example of usage

image.generate-qr:"https://docs.aista.com"
   size:8

After execution, the above invocation slot will contain a MemoryStream encapsulating your underlaying QR code. Below is an example QR code generated by the library.

QR Code

Magic's GitHub project page

Magic is 100% Open Source and you can find the primary project GitHub page here.

Project website for magic.lambda.hyperlambda

The source code for this repository can be found at github.com/polterguy/magic.lambda.image, and you can provide feedback, provide bug reports, etc at the same place.

  • Build status
  • Quality Gate Status
  • Bugs
  • Code Smells
  • Coverage
  • Duplicated Lines (%)
  • Lines of Code
  • Maintainability Rating
  • Reliability Rating
  • Security Rating
  • Technical Debt
  • Vulnerabilities

The projects is copyright Thomas Hansen 2023 - 2024, and professionally maintained by AINIRO.IO.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on magic.lambda.image:

Package Downloads
magic.library

Helper project for Magic to wire up everything easily by simply adding one package, and invoking two simple methods. When using Magic, this is (probably) the only package you should actually add, since this package pulls in everything else you'll need automatically, and wires up everything sanely by default. To use package go to https://polterguy.github.io

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
17.2.0 263 1/22/2024
17.1.7 156 1/12/2024
17.1.6 122 1/11/2024
17.1.5 149 1/5/2024
17.0.1 179 1/1/2024
17.0.0 294 12/14/2023
16.11.5 288 11/12/2023
16.9.0 278 10/9/2023
16.7.0 463 7/11/2023
16.4.1 310 7/2/2023
16.4.0 315 6/22/2023
16.3.1 270 6/7/2023
16.3.0 271 5/28/2023
16.1.9 539 4/30/2023
15.10.11 407 4/13/2023
15.9.1 519 3/27/2023
15.9.0 400 3/24/2023
15.8.2 427 3/20/2023
15.7.0 315 3/6/2023
15.5.0 1,492 1/28/2023
15.2.0 586 1/18/2023
15.1.0 1,093 12/28/2022
14.5.7 641 12/13/2022
14.5.5 742 12/6/2022
14.5.1 594 11/23/2022
14.5.0 550 11/18/2022
14.4.5 627 10/22/2022
14.4.1 685 10/22/2022
14.4.0 594 10/17/2022
14.3.1 1,184 9/12/2022
14.3.0 585 9/10/2022
14.1.3 823 8/7/2022
14.1.2 580 8/7/2022
14.1.1 574 8/7/2022
14.0.14 608 7/26/2022
14.0.12 592 7/24/2022
14.0.11 570 7/23/2022
14.0.10 578 7/23/2022
14.0.9 582 7/23/2022
14.0.8 644 7/17/2022
14.0.5 709 7/11/2022
14.0.4 689 7/6/2022
14.0.3 640 7/2/2022
14.0.2 605 7/2/2022
14.0.0 786 6/25/2022
13.4.0 1,963 5/31/2022
13.3.4 1,368 5/9/2022
13.3.0 883 5/1/2022
13.2.0 1,091 4/21/2022
13.1.0 958 4/7/2022
13.0.0 671 4/5/2022
11.0.5 1,338 3/2/2022
11.0.4 696 2/22/2022
11.0.3 706 2/9/2022
11.0.2 736 2/6/2022
11.0.1 704 2/5/2022
10.0.21 686 1/28/2022
10.0.20 692 1/27/2022
10.0.19 700 1/23/2022
10.0.18 670 1/17/2022
10.0.15 862 12/31/2021
10.0.14 507 12/28/2021
10.0.7 1,380 12/22/2021
10.0.5 670 12/18/2021
9.9.9 1,594 11/29/2021
9.9.3 841 11/9/2021
9.9.2 564 11/4/2021
9.9.0 683 10/30/2021
9.8.9 640 10/29/2021
9.8.7 588 10/27/2021
9.8.6 579 10/27/2021
9.8.5 665 10/26/2021
9.8.0 1,307 10/20/2021
9.7.9 575 10/19/2021
9.7.5 1,429 10/14/2021
9.7.0 803 10/9/2021
9.6.6 1,170 8/14/2021
9.2.0 6,207 5/26/2021
9.1.4 1,213 4/21/2021
9.1.0 997 4/14/2021
9.0.0 808 4/5/2021
8.9.9 933 3/30/2021
8.9.3 1,479 3/19/2021
8.9.2 932 1/29/2021
8.9.1 930 1/24/2021
8.9.0 1,040 1/22/2021
8.6.9 2,890 11/8/2020
8.6.6 1,938 11/2/2020
8.6.0 3,881 10/28/2020
8.5.0 1,795 10/23/2020
8.4.0 5,438 10/13/2020