You must Sign In to post a response.
  • Category: .NET

    Create a RGB combination

    Hello Friends
    Again I have a problem writing a code but this time I dont know how to start writing it
    The idea is to have 3 combo box and each of them has same 5 bands of my image
    From each combo box after choosing a band finally I will get an RGB image in a picture box
    I need your help and Thank you in advance
  • #762766
    Hai Danya,
    As per my understanding regarding your questions is that based on some conditions, you want to create an image using the RGB color.
    So to do this, you can use the class Bitmap under the System.Drawing namespace, which is used to create the image:

    Bitmap bitmap = new Bitmap(100, 100);
    bitmap.SetPixel(0,0,Color.FromARGB(redVal, greenVal, blueVal));

    Now you can set this bitmap to the Imagebox as:

    pictureBox1.Image = bitmap;

    You can also look the below links for more approaches:

    http://stackoverflow.com/questions/12502365/how-to-create-1024x1024-rgb-bitmap-image-of-white
    http://stackoverflow.com/questions/1720160/how-to-create-a-bitmap-programmatically
    https://msdn.microsoft.com/en-us/library/aa287582(v=vs.71).aspx

    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com

  • #762878
    Hey Danya,
    If I got this right, you will have 3 "band" images from which you want to construct an RGB color image.
    Pawan's code sample shows how to construct one pixel (x=0, y=0). If the image is small in size (up to a couple hundred pixels), you can loop through the width and height and set all pixels this way.

    As the image grows larger, setting individual pixels will become considerable slower, so if your images are not small, you might be better off using dedicated imaging functions such as Leadtool's Color Merge function https://www.leadtools.com/help/leadtools/v18/dh/pc/leadtools.imageprocessing.color~leadtools.imageprocessing.color.colormergecommand.html

  • #762880
    Thank youuuuuu all for your help.
    Galnish I thank you so much for your help, your answer is what I'm looking for.
    Many thanks again :)


Sign In to post your comments