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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:11:00+00:00 2026-05-28T22:11:00+00:00

I have 1D array of pixel values and i can get red, green and

  • 0

I have 1D array of pixel values and i can get red, green and blue this way.

int rgb[] = new int[]
        {
            (argb >> 16) & 0xff, //red
            (argb >>  8) & 0xff, //green
            (argb      ) & 0xff  //blue
        };

I know width height of image as well which I want to create.
So, in total I have following data.
1) width of new image
2) height of new image
3) one dimension array of pixel value.

My supervisor has advised me to use createRaster method but function arguments are hard to understand for me.
Can you suggest me some simple code?
Thanks.

  • 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-28T22:11:01+00:00Added an answer on May 28, 2026 at 10:11 pm

    As stated in this previous SO post:

    public static Image getImageFromArray(int[] pixels, int width, int height) {
                BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
                WritableRaster raster = (WritableRaster) image.getData();
                raster.setPixels(0,0,width,height,pixels);
                return image;
            }
    

    If you are having trouble understanding what the parameters are, you should take a look at the Java Documentation.

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

Sidebar

Related Questions

I have an array that contains the RGB colour values for each pixel in
If you have an int array representing individual pixels' RGB and Alpha values, how
I have an array of ushort pixel data (16-bit grayscale values), and I am
i have a pixel array containing the values from 0 to 255 ... i
in this function i have a matrix of colors(each pixel can has a value
I have array like this: $path = array ( [0] => site\projects\terrace_and_balcony\mexico.jpg [1] =>
I have array result like this: Array ( [0] => stdClass Object ( [id_global_info]
Let's say I have array of bytes: byte[] arr = new byte[] { 0,
Hello i have array like this [0] => Array ( [ExamMonth] => Array (
Say I want to create an array of pixel values to pass into the

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.