36 #include <Base/Image/ImageBase.hh>
37 #include <Base/Image/ImageIO.hh>
38 #include <Base/Image/CompressJpeg.hh>
43 int main(
int argc,
char *argv[])
45 if ((argc<3)||(argc>4)) {
46 cout <<
"usage: "<<argv[0]<<
" <in-image-file> <out-image-file>"
47 " [<jpeg-quality: 0..100>]"<<endl;
54 BIASERR(
"Error while loading '"<<argv[1]<<
"' with result="<<result);
58 if (argc > 3) quality = atoi(argv[3]);
59 if ((quality < 0)||(quality > 100)) {
60 BIASERR(
"Given quality (" << quality <<
") not valid!");
66 int res = jHandler.
Compress(srcImg, quality);
68 BIASERR(
"Compression failed (returned "<< res <<
")!!!");
71 string filename(argv[2]);
73 BIASERR(
"Error writing jpeg-image to " << argv[2] <<
"!!!");
Wrapper for fast libjpeg methods.
int WriteJPEG(const std::string &filename)
Write previously compressed data to file named filename.
int Compress(BIAS::Image< unsigned char > &srcImg, int quality=60)
Start compression for given BIAS::Image into buffer.
static int Load(const std::string &FileName, ImageBase &img)
first tries a call to Read MIP image and if that fails, tries to Import Image with all other availabl...
int Init(long size=10485760)
Initialize object with standard values and limit shared memory area to given size (in byte...