main.cpp
来自「实现jpeg的压缩编码功能 在demo2的工程文件中即可查看」· C++ 代码 · 共 24 行
CPP
24 行
#include "StdAfx.h"
#include <fstream>
#include <iostream>
#include "readphoto.h"
#include "JPG.h"
using namespace std;
int main()
{
int nImgWidth, nImgHeight;
unsigned char* img_data= ReadBmpFile("face.bmp", nImgWidth, nImgHeight);
double* img_doulbe_data=new double[nImgWidth*nImgHeight];
for (int i=0;i<nImgHeight*nImgWidth;i++)
{
img_doulbe_data[i]=(double)img_data[i];
// cout<<img_doulbe_data[i]<<" ";
}
delete []img_data;img_data=NULL;
ofstream outFile;
outFile.open("face.jpg",ios::binary);
jpg(img_doulbe_data, nImgHeight, nImgWidth, outFile);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?