Convert a linear scale to a logarithmic scale Given a number n, how would I convert this number into a logarithmic scale? My logarithmic scale would range from 0 to 255 (I'm working with RGB colours), and I would expect values of n from 1 to 1,000,000. Apologies if this is an easy question.

Brenton Dixon

Brenton Dixon

Answered question

2022-07-22

Convert a linear scale to a logarithmic scale
Given a number n, how would I convert this number into a logarithmic scale?
My logarithmic scale would range from 0 to 255 (I'm working with RGB colours), and I would expect values of n from 1 to 1,000,000.
Apologies if this is an easy question.

Answer & Explanation

Alden Holder

Alden Holder

Beginner2022-07-23Added 15 answers

let f ( n ) be the log function of n.
So a general log function can be written as f ( n ) = k log n + c
where k and c are constants
255 = k log 10 6 + c
and 0 = k log 1 + c
here is to the base 10
so c = 0 and k = 255 / 6
or here you can use any base and different values of k
so that f ( n ) = 255 log n 6 if the base is 10.

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?