Advertisement · 728 × 90
#
Hashtag
#imagesharp
Advertisement · 728 × 90
Post image

We've released a new version of Terminaux that addresses all recent ImageMagick security issues.

#Terminaux #csharp #programming #TechNews #TechUpdates #dotnet #library #ImageMagick #ImageSharp

0 0 0 0
Preview
C# Image Resizer Using ZeroMQ and Protobuf Following on from the previous post I decided to attempt to use protobuf rather than json to transmit the data between the producer and the consumers. The updated repo can be found C# Image Resizer Using ZeroMQ and Protobuf].([https://github.com/deltastateonline/ImageProcessor/tree/Using-Protobuf) I found this starting point on using protobuf in c# from Fast and efficient data serialisation with Protocol buffers (protobuf) in .NET. The first step is to add the `protobuf-net` package then define a class for the Image data definition. This class definition is an exact duplicate of the original, but with the required protobuf annotations. using ProtoBuf; namespace Common { [ProtoContract] public class ImageDefProto { [ProtoMember(1)] public required string Id { get; set; } [ProtoMember(2)] public required string Filename { get; set; } [ProtoMember(3)] public required string InputFolder { get; set; } [ProtoMember(4)] public required string OutputFolder { get; set; } [ProtoMember(5)] public decimal Resize { get; set; } } } The next step is to create a helper class which is used to serialize and deserialize the class into a byte array and from a byte array via a memory stream. namespace Common { public static class ProtobufHelpers { public static byte[] SerializeObject<T>(T record) where T : class { using (var stream = new MemoryStream()) { Serializer.Serialize(stream, record); return stream.ToArray(); } } public static T DeserializeObject<T>(byte[] data) { T obj = default(T); using (var stream = new MemoryStream(data)) { obj = Serializer.Deserialize<T>(stream); } return obj; } } } In the ImageListing project, the image definition object has to be serialized as follows and published. var msg = new ImageDefProto { Id = messageId.ToString(), Filename = file, InputFolder = path, OutputFolder = outputPath, Resize = resize }; string encodedText = Convert.ToBase64String(ProtobufHelpers.SerializeObject(msg)); publisher.SendFrame(encodedText); While in the ImageProcessor project the data is deserialized and consumed. if (!subscriber.TryReceiveFrameString(TimeSpan.FromMilliseconds(5000), out string receivedFrame)) { Console.WriteLine("Timeout reached, no more messages. Exiting..."); break; } byte[] textBytes = Convert.FromBase64String(receivedFrame); var imageDetails = ProtobufHelpers.DeserializeObject<ImageDefProto>(textBytes); Console.WriteLine(JsonSerializer.Serialize(imageDetails, jsonSerializerOptions)); await ResizeImage(imageDetails); # Conclusion In this implmentation, it can be seen that using protobuf saves about 32% of the space required to transmit the data. This may not seem like much but in high volume systems and systems with limited resources, protobuf would be an excellent option. Let this post be a practical example for using protobuf. There are a number of reasons why you would choose using json over protobuf or vice versa - > Ask ChatGPT In summary. ## Using Json length of string = 305; eyJJZCI6IjAiLCJGaWxlbmFtZSI6IkM6XFxVc2Vyc1xcb21vXFxQaWN0dXJlc1xcMjAyNS0wMy0wMS1mb290YmFsbFxcSU1HXzQxOTUuSlBHIiwiSW5wdXRGb2xkZXIiOiJDOlxcVXNlcnNcXG9tb1xcUGljdHVyZXNcXDIwMjUtMDMtMDEtZm9vdGJhbGwiLCJPdXRwdXRGb2xkZXIiOiJDOlxcVXNlcnNcXG9tb1xcUGljdHVyZXNcXDIwMjUtMDMtMDEtZm9vdGJhbGxfQ1NoYXJwIiwiUmVzaXplIjoyMH0= ## Using Protobuf length of string = 209; CgEwEjZDOlxVc2Vyc1xvbW9cUGljdHVyZXNcMjAyNS0wMy0wMS1mb290YmFsbFxJTUdfNDE5NS5KUEcaKUM6XFVzZXJzXG9tb1xQaWN0dXJlc1wyMDI1LTAzLTAxLWZvb3RiYWxsIjBDOlxVc2Vyc1xvbW9cUGljdHVyZXNcMjAyNS0wMy0wMS1mb290YmFsbF9DU2hhcnAqAggU Please like and leave a comment on this post. Next feature would be to implement commandline parameters and options for the ImageListing project.
0 0 0 0
Preview
C# Image Resizer Using ZeroMQ ## Introduction I previously served as the General Secretary of an association based in Brisbane. Throughout the year, we host around three events where professional photographers capture numerous high-quality images. Some of these photos can be as large as 18MB. Once the events conclude, the pictures need to be uploaded to Google Albums and shared with our community. At our most recent event, the total upload size reached 5GB. I had previously implemented an image resizer in php which I executed by running php process.php imageprocessing <input-folder> [<output-folder> [<size>]] The files in the input folder were processed sequentially, which worked well for a small number of images and for smaller file sizes—around 5MB. However, when handling a large volume of files, the process became slow and occasionally crashed due to PHP running out of memory. A more efficient approach would be to distribute the resizing task across multiple workers. This can be achieved using a simple pub/sub messaging pattern, where the publisher gathers a list of all images to be processed and then sends messages containing the necessary details for resizing. The workers retrieve messages from the queue and handle their processing. A message can be defined as { "Id": "1", "Filename": "2025\\MENS EVENT_2025\\1D2A7537.JPG", "InputFolder": "2025\\MENS EVENT_2025", "OutputFolder": "2025\\MENS EVENT_2025_CSharp", "Resize": 20 } ## Solution The ImageProcessor in the repository has been implemented in C# using ZeroMQ and the NetMq nuget package. It also uses SixLabors.ImageSharp to resize the image. It consists of 1. Publisher project - ImageListing 2. Worker project - ImageProcessor `The publisher` `The worker` Both projects can be used as follows: .\ImageListing.exe "\2025\MENS EVENT_2025" "2025\MENS EVENT_2025_CSharp" 20 .\ImageProcessor.exe 1 .\ImageProcessor.exe 2 .\ImageProcessor.exe 3 .\ImageProcessor.exe 4 ## Finally I began experimenting with ZeroMQ in October 2024 while searching for an embedded library—similar to SQLite—that wouldn't require installing additional software. There are other message brokers such as Rabbitmq, ActiveMQ, Azure Service Bus and Aws SNS/SQS. I worked on Java-HowTo-SNS utilizing AWS SNS for a similar task in Java. Using ZeroMQ offered a more complete and contained solution. Additionally, by integrating ImageSharp, watermarks can be seamlessly added to images during resizing.
0 0 0 0
Preview
C# Image Resizer Using ZeroMQ ## Introduction I previously served as the General Secretary of an association based in Brisbane. Throughout the year, we host around three events where professional photographers capture numerous high-quality images. Some of these photos can be as large as 18MB. Once the events conclude, the pictures need to be uploaded to Google Albums and shared with our community. At our most recent event, the total upload size reached 5GB. I had previously implemented an image resizer in php which I executed by running php process.php imageprocessing <input-folder> [<output-folder> [<size>]] The files in the input folder were processed sequentially, which worked well for a small number of images and for smaller file sizes—around 5MB. However, when handling a large volume of files, the process became slow and occasionally crashed due to PHP running out of memory. A more efficient approach would be to distribute the resizing task across multiple workers. This can be achieved using a simple pub/sub messaging pattern, where the publisher gathers a list of all images to be processed and then sends messages containing the necessary details for resizing. The workers retrieve messages from the queue and handle their processing. A message can be defined as { "Id": "1", "Filename": "2025\\MENS EVENT_2025\\1D2A7537.JPG", "InputFolder": "2025\\MENS EVENT_2025", "OutputFolder": "2025\\MENS EVENT_2025_CSharp", "Resize": 20 } ## Solution The ImageProcessor in the repository has been implemented in C# using ZeroMQ and the NetMq nuget package. It also uses SixLabors.ImageSharp to resize the image. It consists of 1. Publisher project - ImageListing 2. Worker project - ImageProcessor `The publisher` `The worker` Both projects can be used as follows: .\ImageListing.exe "\2025\MENS EVENT_2025" "2025\MENS EVENT_2025_CSharp" 20 .\ImageProcessor.exe 1 .\ImageProcessor.exe 2 .\ImageProcessor.exe 3 .\ImageProcessor.exe 4 ## Finally I began experimenting with ZeroMQ in October 2024 while searching for an embedded library—similar to SQLite—that wouldn't require installing additional software. There are other message brokers such as Rabbitmq, ActiveMQ, Azure Service Bus and Aws SNS/SQS. I worked on Java-HowTo-SNS utilizing AWS SNS for a similar task in Java. Using ZeroMQ offered a more complete and contained solution. Additionally, by integrating ImageSharp, watermarks can be seamlessly added to images during resizing.
0 0 0 0

Added support for ImageFlow to my collection of converter extensions.

https://github.com/mortara/Image-converter-extensions

#dotnet #csharp #skiasharp #imagesharp #imageflow

2 1 0 0
Preview
GitHub - mortara/Image-converter-extensions: A collection of extensions to convert between different image formats A collection of extensions to convert between different image formats - mortara/Image-converter-extensions

github.com/mortara/Imag...

A collection of #csharp exetensions to convert images between different imaging libraries. #skiasharp #emgucv #imagesharp

0 0 0 0

https://github.com/mortara/Image-converter-extensions

Now with support for ImageSharp! #csharp #emgucv #magicknet #imagesharp #dotnet #skiasharp

0 0 0 0

The latest Verified Accounts Daily Digest! paper.li/billdollins/1547987929 Thanks to @CillizzaCNN #imagesharp #dotnet

0 0 0 0