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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:48:27+00:00 2026-05-29T15:48:27+00:00

I am a complete novice to image processing, and I am guessing this is

  • 0

I am a complete novice to image processing, and I am guessing this is quite easy to do, but I just don’t know the terminology.

Basically, I have a black and white image, I simply want to apply a colored overlay to the image, so that I have got the image overlayed with blue green red and yellow like the images shown below (which actually I can’t show because I don’t have enough reputation to do so – grrrrrr). Imagine I have a physical image, and a green/red/blue/yellow overlay, which I place on top of the image.

Ideally, I would like to do this using Python PIL but I would be just as happy to do it using ImageMagik, but either way, I need to be able to script the process as I have 100 or so images that I need to carry out the process on.

  • 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-29T15:48:29+00:00Added an answer on May 29, 2026 at 3:48 pm

    EDIT: As mentioned by Matt in the comments, this functionality is now available in skimage.color.label2rgb.

    In the latest development version, we’ve also introduced a saturation parameter, which allows you to add overlays to color images.


    Here’s a code snippet that shows how to use scikit-image to overlay colors on a grey-level image. The idea is to convert both images to the HSV color space, and then to replace the hue and saturation values of the grey-level image with those of the color mask.

    from skimage import data, color, io, img_as_float
    import numpy as np
    import matplotlib.pyplot as plt
    
    alpha = 0.6
    
    img = img_as_float(data.camera())
    rows, cols = img.shape
    
    # Construct a colour image to superimpose
    color_mask = np.zeros((rows, cols, 3))
    color_mask[30:140, 30:140] = [1, 0, 0]  # Red block
    color_mask[170:270, 40:120] = [0, 1, 0] # Green block
    color_mask[200:350, 200:350] = [0, 0, 1] # Blue block
    
    # Construct RGB version of grey-level image
    img_color = np.dstack((img, img, img))
    
    # Convert the input image and color mask to Hue Saturation Value (HSV)
    # colorspace
    img_hsv = color.rgb2hsv(img_color)
    color_mask_hsv = color.rgb2hsv(color_mask)
    
    # Replace the hue and saturation of the original image
    # with that of the color mask
    img_hsv[..., 0] = color_mask_hsv[..., 0]
    img_hsv[..., 1] = color_mask_hsv[..., 1] * alpha
    
    img_masked = color.hsv2rgb(img_hsv)
    
    # Display the output
    f, (ax0, ax1, ax2) = plt.subplots(1, 3,
                                      subplot_kw={'xticks': [], 'yticks': []})
    ax0.imshow(img, cmap=plt.cm.gray)
    ax1.imshow(color_mask)
    ax2.imshow(img_masked)
    plt.show()
    

    Here’s the output:

    enter image description here

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

Sidebar

Related Questions

I'm a complete novice, so I'm probably missing something really easy, but I can't
So, to preface, I'm a complete novice at this Excel business. I've found similar
Complete novice question. I've used jQuery a bit, YUI not at all and know
complete novice at work (who is also ill and feeling particularly thick) I have
I'm sure I've seen this before and know the answer to it but after
I am a complete novice when coming to using Flash but I am looking
My apologies but I am a complete novice. Hopefully a quick one for you
having some trouble trying to figure this out, complete novice when it come to
I am a complete novice at php and postgres. I have been searching all
Rails nooby so I don't know what info to provide. Basically when my show

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.