Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6189677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:27:19+00:00 2026-05-24T02:27:19+00:00

I have an complex problem, but it could be solved via this little problem.

  • 0

I have an complex problem, but it could be solved via this little problem. I would like to make a colorizer, which works per pixel.

I have a defined base color for the picture (the picture has some pixels with this color and a lot of other pixels, which are near to this color):

Hex: #188DD9
HSL: 204° 80% 47%
RGB: 24 141 217

I know my target base color:

Hex: #23752E
HSL: 128° 54% 30%
RGB: 35 117 46

So, I would like to colorize an image.

My assumption is that if I find the correlation in this two HSL values, I can
colorize my picture pixel by pixel.

Currently I found that if I move the base color hue with (target hue – base hue) = -76, the hue will be fine.

Could you direct me where is the connexion between saturation and lightness to solve this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:27:20+00:00Added an answer on May 24, 2026 at 2:27 am

    I assume that, whatever mapping you end up using, you want to map black to black, white to white and grays to grays.

    The additive mapping

    H’ = H + (Htarget – Hbase)

    (with wrap-around) you use for hue is indeed probably fine. For saturation, the need to preserve gray values suggest a multiplicative mapping

    S’ = S * (Starget / Sbase),

    with values exceeding 100% saturation clipped. However, for lightness, a linear map just isn’t going to do it, since you want to fix both 0% and 100% lightness while adjusting intermediate values. A natural choice might instead be a gamma-type map, i.e.

    L’ = pow( L, log(Ltarget) / log(Lbase) ) = exp( log(L) * log(Ltarget) / log(Lbase) ).

    where the lightness values are scaled to between 0 and 1. (Note: To calculate this map efficiently for lots of pixels, you probably want to precompute a lookup table of, say, 256 entries.)

    Of course, there are plenty of other maps you could use, but I’d start with these and see if they give good enough results. Note that, ultimately, the quality of your results may also be limited by the perceptual non-uniformity of the HSL color space; for details, see this Wikipedia page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a reasonably complex layout problem: I would like to have a main
I have a complex command that I'd like to make a shell/bash script of.
Actually, I have a very complex problem, but I have narrowed it down here
I have a complex MySQL problem. SELECT * FROM banners, content_id_country, languages WHERE content_id_country.content_id
I have a complex sorting problem with my SQL statement. I have a table
I have a complex SQL problem in MS SQL Server, and in drawing on
I am using WCF and REST, and I have complex types, which are working
This is a problem I encounter frequently in working with more complex systems and
I have a little problem with threads in Erlang NIFs. You can view my
Say I have a bunch of data on some people. This could include Name,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.