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 9012507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:01:02+00:00 2026-06-16T03:01:02+00:00

How I can change the colors from this: into this: I generated the output

  • 0

How I can change the colors from this:

enter image description here

into this:

enter image description here

I generated the output image using Gimp with the input image as layer one, and the background color from the image as layer two, in the Layers panel I selected the mode “colors”

I want preserve the background color, but want the colors be shades of brown.

Any ideas to do this with ChunkyPNG? Or should I use ImageMagick with color lookup tables?

  • 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-06-16T03:01:03+00:00Added an answer on June 16, 2026 at 3:01 am

    Thanks for your ideas.

    I found the one from Linuxios the most helpful Gimp layer modes

    require "json"
    require "httpclient"
    require "chunky_png"
    
    module ChunkyPNG::Color
    
      def h(value)
        r,g,b = r(value).to_f / MAX, g(value).to_f / MAX, b(value).to_f / MAX
        min, max = [r,g,b].minmax
    
        return 0 if max == min
    
        result = case max
          when r then (g - b) / (max - min) + (g < b ? 6 : 0)
          when g then (b - r) / (max - min) + 2
          when b then (r - g) / (max - min) + 4
        end
    
        result * 60
      end
    
      def s(value)
        min, max = [r(value), g(value), b(value)].minmax.map { |value| value.to_f / MAX }
        max == 0 ? 0 : (max - min) / max
      end
    
      def v(value)
        [r(value), g(value), b(value)].max.to_f / MAX
      end
    
      def hsv(h, s, v)
        h = h.to_f / 360
        i = (h * 6).floor
        f = h * 6 - i
        p = v * (1 - s)
        q = v * (1 - f * s)
        t = v * (1 - (1 - f) * s)
    
         case i % 6
          when 0 then r, g, b = v, t, p
          when 1 then r, g, b = q, v, p
          when 2 then r, g, b = p, v, t
          when 3 then r, g, b = p, q, v
          when 4 then r, g, b = t, p, v
          when 5 then r, g, b = v, p, q
        end
    
        rgb *[r,g,b].map {|value| (value * 255).round }
      end
    
    end
    
    
    module CoderWall
    
      module_function
    
      def badges(username)
        url = URI.escape("https://coderwall.com/#{username}.json")
        response = HTTPClient.get(url)
    
        json = JSON.parse(response.body)
        urls = json['badges'].map {|b| b['badge']}
        brown      = ChunkyPNG::Color.from_hex("#bf8a30")
        hue        = ChunkyPNG::Color.h(brown)
        saturation = ChunkyPNG::Color.s(brown)
        value      = ChunkyPNG::Color.v(brown)
        urls.each do |url|
          matches = url.match /(\w+)\-/
          response = HTTPClient.get(url)
          filename = "./tmp/coderwall/"+matches[1]+".png"
          File.open(filename,"w") {|f| f.write(response.body)}
    
          image = ChunkyPNG::Image.from_file(filename)
    
          image.pixels.map! do |pixel|
              v = ChunkyPNG::Color.v(pixel)
              unless ChunkyPNG::Color.a(pixel) > 0
                v = value
              end
              ChunkyPNG::Color.hsv(hue,saturation, v)
          end
          image.save(filename.gsub(/\.png/,"_brown.png"), :fast_rgba)
        end
      end
    end
    
    badges = CoderWall.badges("astropanic")
    

    That above code consists from some snippets found around the web.

    Here is the result: Stop doing new year resolutions. Make the change now !

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

Sidebar

Related Questions

Using AppleScript, how can I change the background color of cells ranging from A3
from this code will show in original color how can i change it to
How can I change the color of the alert view box from blue to
How can I change the star colors and size of the stars?
I can see how to change the fonts and colors in the IDE. Is
How i can change the color with gradient??? I have this now,but is different
au InsertEnter * hi Normal ctermbg=233 Doing this causes all the colors from my
This method is supposed to change the image being displayed on a JFrame gradually
Original question: This method is supposed to change the image being displayed on a
How can i change the color of a link after it has been selected,

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.