
- #Color palette converter utility how to
- #Color palette converter utility code
- #Color palette converter utility series
Lab2xyz := chromath.NewLabTransformer(targetIlluminant) Rgb2xyz := chromath.NewRGBTransformer(&chromath.SpaceSRGB, &chromath.AdaptationBradford, targetIlluminant, &chromath.Scaler8bClamping, 1.0, nil) TargetIlluminant := &chromath.IlluminantRefD50 The goal of our utils package is to encapsulate all the color extraction logic into a function that will look like this: func GetProminentColors(imageContent io.Reader, palette Palette) (string, error) Palette is a custom type that is essentially an alias for a map that relates a string (color name) to an array of integers (the R, G and B components of the color). We can define a palette of colors as follows: type Palette mapuint32 This internal utility package will contain the logic that is needed to extract prominent colors and to normalize them to a palette of pre-defined colors.

Finally, as a result of all the above points, you, as a developer, can focus a lot more on the business logic and the value proposition of your product, rather than thinking about infrastructure.
#Color palette converter utility how to
Other important aspects like metrics or logging are provided to you as integration with other cloud services, so again, you don't have to figure out on your own how to support these capabilities.You only pay for the amount of computation as a function of the total time taken by all running lambdas and the memory allocated for every execution.Once the traffic drops, instances are removed to adjust to the decreased load. If you suddenly have a spike of requests, the runtime will automatically allocate more instances of your lambda and distribute the load between them for you. Your functions will scale up and down automatically.You don't have to worry about servers, like which operative system to install, when to update, disk space, networking, system optimisations, etc.In the last few years, this approach is gaining a lot of popularity because it offers several advantages over traditional cloud development alternatives:
#Color palette converter utility code
If you are here, you probably know already about AWS Lambda and, if that's the case, you should be ok to skip this section.įor those who are new to the concept, Lambda is essentially a cloud runtime that allows you to run code without having to manage servers, this is why Lambda and similar technologies are often referred to as Serverless runtimes. This operation is done through the AWS SDK as well.

In this example, the algorithm picked Green and Turquoise as the most prevalent colors of the picture. Once the content of the image is loaded, it is processed through a library that allows us to extrapolate a number of the most prominent colors.

These colors are then stored on the bucket object as tags. More specifically, we will build a lambda function to process images saved into an S3 bucket and determine the most significative ( prominent) colors. In this article, we will learn how to write and deploy a Lambda function on AWS Cloud by using Go. Part 2: Integration testing for AWS Lambda in Go with Docker-compose.
#Color palette converter utility series
This article is part 1 of the series on AWS Lambda.
