By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,257 Members | 928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,257 IT Pros & Developers. It's quick & easy.

i want to read image form c and compress it

P: 3
I want to read image form c and compress it on turbo c.

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5.   FILE*fptr;
  6.     fptr=fopen("D:\\abc.jpg","r");
  7.     printf("%c",getc(fptr));
  8. }
  9. getch();
  10. }
Apr 27 '11 #1
Share this Question
Share on Google+
1 Reply


P: 3
Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. int i;
  6. char a;
  7.  
  8. FILE*fptr;
  9.  clrscr();
  10. fptr=fopen("C:\\h.jpg","r");
  11.  
  12. while(1)
  13. {
  14.  if(fgetc(fptr)!=EOF)
  15.  {
  16.  
  17.    printf("%f",fgetc(fptr));
  18.  }
  19. else
  20.     {
  21.     break;
  22.     }
  23. }
  24. getch();
  25. }


This project reads an image, please tell me if this program loads the get image correctly or not. Another question is that I get image header or bytes.
Apr 27 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.