Click here to Skip to main content
16,020,628 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to create a C program for image steganography.


What I have tried:

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

int main(){
    FILE *image;
    char fpath[1000],mydata[100];
	BITMAPINFOHEADER bih;
    int i=0,b[8],g[8],r[8];
    double asciiTobinary;
    printf("Enter BMP file path");
    scanf("%s",fpath);
   
                       
                                       
    image=fopen(fpath,"rb");
    while(image==NULL){
     printf("Error! Enter path again:");
        scanf("%s",fpath);
                     }

    fseek(image,2,SEEK_SET);                                                //reading the height and width
    fread(&bih.size,4,1,image);
    printf("\n \n Size of the image=%d\n",bih.size);
    fseek(image,18,SEEK_SET);
    fread(&bih.width,4,1,image);
    fseek(image,22,SEEK_SET);
    fread(&bih.height,4,1,image);
    printf("\n \n Width of the image =%d \n Height of the image =%d \n pixel =  b    |    g     |     r \n \n",bih.width,bih.height);

     PIXEL pic[bih.width*bih.height*2],p; 
     
      while(!feof(image)){                                                 //reading the pixels rgb values
      fread(&p.blue,sizeof(p.blue),1,image);                              
      fread(&p.green,sizeof(p.green),1,image);
      fread(&p.red,sizeof(p.red),1,image);
      pic[i]=p;
      printf(" %d=   %u    |     %u    |      %u  ",i+54,pic[i].blue,pic[i].green,pic[i].red);
      
                                                         
      i++;
                       }
                     
                       
                       
                      
     fclose(image);
     return 0;
}
Posted
Updated 15-Apr-22 7:42am
v2
Comments
jeron1 5-Apr-22 11:46am    
Your question is?
Patrice T 5-Apr-22 11:54am    
So you are asking us to do the job for you for free.
jeron1 5-Apr-22 13:44pm    
" for the question i ask"

and your question is?

1 solution

Have a look at Steganography - Hiding messages in the Noise of a Picture[^]. It is C# but you get the idea.
 
Share this answer
 
Comments
Patrice T 9-Apr-22 11:41am    
+5
CPallini 9-Apr-22 13:40pm    
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900