magic.lambda.image
17.1.6
See the version list below for details.
dotnet add package magic.lambda.image --version 17.1.6
NuGet\Install-Package magic.lambda.image -Version 17.1.6
<PackageReference Include="magic.lambda.image" Version="17.1.6" />
paket add magic.lambda.image --version 17.1.6
#r "nuget: magic.lambda.image, 17.1.6"
// Install magic.lambda.image as a Cake Addin #addin nuget:?package=magic.lambda.image&version=17.1.6 // Install magic.lambda.image as a Cake Tool #tool nuget:?package=magic.lambda.image&version=17.1.6
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.
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.
Copyright and maintenance
The projects is copyright Thomas Hansen 2023 - 2024, and professionally maintained by AINIRO.IO.
Product | Versions 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. |
-
.NETStandard 2.0
- magic.node.extensions (>= 17.1.6)
- magic.signals.contracts (>= 17.1.6)
- QRCoder (>= 1.4.3)
- SixLabors.ImageSharp (>= 2.1.3)
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 | 431 | 1/22/2024 |
17.1.7 | 191 | 1/12/2024 |
17.1.6 | 158 | 1/11/2024 |
17.1.5 | 181 | 1/5/2024 |
17.0.1 | 222 | 1/1/2024 |
17.0.0 | 346 | 12/14/2023 |
16.11.5 | 334 | 11/12/2023 |
16.9.0 | 311 | 10/9/2023 |
16.7.0 | 533 | 7/11/2023 |
16.4.1 | 362 | 7/2/2023 |
16.4.0 | 362 | 6/22/2023 |
16.3.1 | 305 | 6/7/2023 |
16.3.0 | 307 | 5/28/2023 |
16.1.9 | 583 | 4/30/2023 |
15.10.11 | 438 | 4/13/2023 |
15.9.1 | 557 | 3/27/2023 |
15.9.0 | 427 | 3/24/2023 |
15.8.2 | 462 | 3/20/2023 |
15.7.0 | 350 | 3/6/2023 |
15.5.0 | 1,565 | 1/28/2023 |
15.2.0 | 627 | 1/18/2023 |
15.1.0 | 1,131 | 12/28/2022 |
14.5.7 | 676 | 12/13/2022 |
14.5.5 | 777 | 12/6/2022 |
14.5.1 | 623 | 11/23/2022 |
14.5.0 | 581 | 11/18/2022 |
14.4.5 | 657 | 10/22/2022 |
14.4.1 | 724 | 10/22/2022 |
14.4.0 | 628 | 10/17/2022 |
14.3.1 | 1,224 | 9/12/2022 |
14.3.0 | 618 | 9/10/2022 |
14.1.3 | 854 | 8/7/2022 |
14.1.2 | 612 | 8/7/2022 |
14.1.1 | 605 | 8/7/2022 |
14.0.14 | 637 | 7/26/2022 |
14.0.12 | 624 | 7/24/2022 |
14.0.11 | 598 | 7/23/2022 |
14.0.10 | 611 | 7/23/2022 |
14.0.9 | 609 | 7/23/2022 |
14.0.8 | 676 | 7/17/2022 |
14.0.5 | 739 | 7/11/2022 |
14.0.4 | 725 | 7/6/2022 |
14.0.3 | 671 | 7/2/2022 |
14.0.2 | 638 | 7/2/2022 |
14.0.0 | 825 | 6/25/2022 |
13.4.0 | 2,028 | 5/31/2022 |
13.3.4 | 1,412 | 5/9/2022 |
13.3.0 | 915 | 5/1/2022 |
13.2.0 | 1,129 | 4/21/2022 |
13.1.0 | 985 | 4/7/2022 |
13.0.0 | 688 | 4/5/2022 |
11.0.5 | 1,380 | 3/2/2022 |
11.0.4 | 727 | 2/22/2022 |
11.0.3 | 736 | 2/9/2022 |
11.0.2 | 768 | 2/6/2022 |
11.0.1 | 736 | 2/5/2022 |
10.0.21 | 720 | 1/28/2022 |
10.0.20 | 723 | 1/27/2022 |
10.0.19 | 726 | 1/23/2022 |
10.0.18 | 698 | 1/17/2022 |
10.0.15 | 904 | 12/31/2021 |
10.0.14 | 536 | 12/28/2021 |
10.0.7 | 1,431 | 12/22/2021 |
10.0.5 | 701 | 12/18/2021 |
9.9.9 | 1,650 | 11/29/2021 |
9.9.3 | 885 | 11/9/2021 |
9.9.2 | 593 | 11/4/2021 |
9.9.0 | 710 | 10/30/2021 |
9.8.9 | 670 | 10/29/2021 |
9.8.7 | 618 | 10/27/2021 |
9.8.6 | 610 | 10/27/2021 |
9.8.5 | 686 | 10/26/2021 |
9.8.0 | 1,360 | 10/20/2021 |
9.7.9 | 609 | 10/19/2021 |
9.7.5 | 1,466 | 10/14/2021 |
9.7.0 | 847 | 10/9/2021 |
9.6.6 | 1,218 | 8/14/2021 |
9.2.0 | 6,364 | 5/26/2021 |
9.1.4 | 1,249 | 4/21/2021 |
9.1.0 | 1,037 | 4/14/2021 |
9.0.0 | 840 | 4/5/2021 |
8.9.9 | 958 | 3/30/2021 |
8.9.3 | 1,525 | 3/19/2021 |
8.9.2 | 961 | 1/29/2021 |
8.9.1 | 955 | 1/24/2021 |
8.9.0 | 1,067 | 1/22/2021 |
8.6.9 | 2,933 | 11/8/2020 |
8.6.6 | 1,972 | 11/2/2020 |
8.6.0 | 3,932 | 10/28/2020 |
8.5.0 | 1,831 | 10/23/2020 |
8.4.0 | 5,508 | 10/13/2020 |