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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:33:03+00:00 2026-06-17T12:33:03+00:00

I am trying to decode the data encoded in the image. The encoding works

  • 0

I am trying to decode the data encoded in the image. The encoding works fine and the data size of image also changes but for some reason the decoded data is an empty string. Either the encoded data get lost or this code has some mistake.

int temp,tempText=0,x=0,p=0;

    try
    {
        image= ImageIO.read(new File("C:\\Users\\Desktop\\Encoded.png"));

    }
    catch (IOException e)
    {
        e.printStackTrace();
    }


    for(int i=0;i<image.getWidth();i++)
    {
        for(int j=0;j<image.getHeight();j++)
        {
            pixels[i][j]=image.getRGB(i, j);
        }
    }

    for(int i=0;i<Width;i++)
    {
        for(int j=0;j<Height;j++)
        {
            temp=pixels[i][j];

            int change=0;   

            for(int k=0;k<4;k++) // 4 iterations for 4bytes of every pixel
            {
                if(k==0)
                {
                    change=1;
                }
                else
                    if(k==1)
                    {
                        change=256;
                    }
                    else
                        if(k==2)
                        {
                            change=65536;
                        }
                        else
                            if(k==3)
                            {
                                change = 16777216;
                            }


                tempText=tempText | (pixels[i][j] & change);

                p++;

                if(p==8) // because character is of 8bits
                {
                    myString.concat(String.valueOf(tempText));// Writing decoded data in string
                    p=0;
                    tempText=0;

                }
            }


        }

 // Writing in file

    try
    {
        file = new File("C:\\Users\\Desktop\\Retreive.txt");
        fw = new FileWriter(file);

        bw= new BufferedWriter(fw);

        bw.write(myString);
        bw.close();

    } 
    catch (Exception e) 
    {
        e.printStackTrace();
    }

Kindly notify me if any mistake I am making or any thing this code is lacking.

  • 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-17T12:33:04+00:00Added an answer on June 17, 2026 at 12:33 pm

    String.concat doesn’t change the string you call it on, but instead returns a new string. So if you use myString = myString.concat(...) instead, you might get better results. If tempText contains a character code, you could cast it to a char (since String.valueOf returns the string representation of the int):

    // Writing decoded data in string
    // myString = myString.concat(String.valueOf(tempText));
    myString += (char) tempText;
    

    instead of:

    myString.concat(String.valueOf(tempText));// Writing decoded data in string
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to do a mock-up in Matlab on some image data in a
I am trying to pass some encrypted data to a flash , but I
Trying to decode an invalid encoded utf-8 html page gives different results in python,
I'm pretty new to jquery . But I've been trying to add a decode
I've been trying to Base64 encode image data from the user (in this case
I'm trying to rebuild an object encoded with Json but i'm not getting any
I am trying to use MessagingToolkit to decode an image in C#/ASP.NET. I have
I am trying to store some cryptographic data in couchdb. I need to store
We are trying to decode some uuencoded PDF files that are embedded in a
I'm trying to access some data through JSON RPC using the trac XMLRPCPlugin using

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.