How can i convert an image file another image file?
Jun 15, 2011 at 7:47pm UTC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <fstream>
#include <iostream>
using namespace std;
int main(){long size,start,theend;
char *c;
std::ifstream file1("C:\\exam.tga" ,ios::in|ios::binary);
std::ofstream file2("F:\\Pic.jpg" ,ios::out|ios::binary);
start=file1.tellg();
file1.seekg(0,ios::end);
theend=file1.tellg();
size=theend-start;
c=new char [size];
if (file1.read(c,size)&&dosya2.write(c,size))
cout<<"Succ\n" ;
else
perror("Not Succ.Because:" );
delete [] c;
system("PAUSE" );
return 0;}
I want to a tga file to convert another jpg file.
Jun 16, 2011 at 7:14am UTC
You can either read up on how exactly both formats are stored and write your own conversion algorithm (quite complicated) or use one of many libraries written for this purpose. For example,
http://freeimage.sourceforge.net/
Topic archived. No new replies allowed.