⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 实现jpeg的压缩编码功能 在demo2的工程文件中即可查看
💻 CPP
字号:
#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_base::out|ios::binary);
   jpg(img_doulbe_data, nImgHeight, nImgWidth, outFile);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -