当前位置: 首页 > news >正文

手机网站设计开发怎样安装微信小程序

手机网站设计开发,怎样安装微信小程序,sem是什么牌子,关于我校校园网站建设的调研报告jpg压缩原理可以参考这篇文章http://hi.baidu.com/tiandsp/item/f5a2dcde6ef1405bd73aae41#xff0c;我很早以前转的一篇文章。 没有使用libjpeg的压缩代码可以看看这篇文章http://hi.baidu.com/tiandsp/item/9b5843c58a3b4474cfd4f841#xff0c;也是我很早以前转的。 这次…  jpg压缩原理可以参考这篇文章http://hi.baidu.com/tiandsp/item/f5a2dcde6ef1405bd73aae41我很早以前转的一篇文章。   没有使用libjpeg的压缩代码可以看看这篇文章http://hi.baidu.com/tiandsp/item/9b5843c58a3b4474cfd4f841也是我很早以前转的。   这次使用libjpeg库压缩和上一篇的解压正好对应起来有好多函数名称我都是对称的起的所以结合起来看效果更好。   和上一篇一样只能处理24位和8位的图像。   代码如下 #include iostream #include stdio.h extern C{ #include jpeglib.h }; #pragma comment(lib,jpeg.lib) using namespace std;#pragma pack(2) //两字节对齐否则bmp_fileheader会占16Byte struct bmp_fileheader {unsigned short bfType; //若不对齐这个会占4Byteunsigned long bfSize;unsigned short bfReverved1;unsigned short bfReverved2;unsigned long bfOffBits; };struct bmp_infoheader {unsigned long biSize;unsigned long biWidth;unsigned long biHeight;unsigned short biPlanes;unsigned short biBitCount;unsigned long biCompression;unsigned long biSizeImage;unsigned long biXPelsPerMeter;unsigned long biYpelsPerMeter;unsigned long biClrUsed;unsigned long biClrImportant; };FILE *input_file; FILE *output_file;struct bmp_fileheader bfh; struct bmp_infoheader bih;unsigned char *src_buffer; unsigned char *dst_buffer;void read_bmp_header() { fread(bfh,sizeof(struct bmp_fileheader),1,input_file);fread(bih,sizeof(struct bmp_infoheader),1,input_file); }void read_bmp_data() {fseek(input_file,bfh.bfOffBits,SEEK_SET);src_buffernew unsigned char[bih.biWidth*bih.biHeight*bih.biBitCount/8];fread(src_buffer,sizeof(unsigned char)*bih.biWidth*bih.biHeight*bih.biBitCount/8,1,input_file);unsigned long widthbih.biWidth;unsigned long heightbih.biHeight;unsigned short depthunsigned short(bih.biBitCount/8);unsigned char *src_point;unsigned char *dst_point;dst_buffernew unsigned char[width*height*depth]; src_pointsrc_bufferwidth*depth*(height-1);dst_pointdst_bufferwidth*depth*(height-1);for (unsigned long i0;iheight;i){for (unsigned long j0;jwidth*depth;jdepth){if (depth1) //处理灰度图{dst_point[j]src_point[j];}if (depth3) //处理彩色图{dst_point[j2]src_point[j0];dst_point[j1]src_point[j1];dst_point[j0]src_point[j2];}}dst_point-width*depth;src_point-width*depth;} }void synthese_jpeg() {struct jpeg_compress_struct cinfo;struct jpeg_error_mgr jerr;JSAMPARRAY buffer;unsigned long widthbih.biWidth;unsigned long heightbih.biHeight;unsigned short depthunsigned short(bih.biBitCount/8);unsigned char *point;cinfo.errjpeg_std_error(jerr); //libjpeg各种配置jpeg_create_compress(cinfo);jpeg_stdio_dest(cinfo,output_file);cinfo.image_widthwidth;cinfo.image_heightheight;cinfo.input_componentsdepth;if (depth1)cinfo.in_color_spaceJCS_GRAYSCALE;elsecinfo.in_color_spaceJCS_RGB;jpeg_set_defaults(cinfo);jpeg_set_quality(cinfo,20,TRUE); //中间的值为压缩质量越大质量越好jpeg_start_compress(cinfo,TRUE);buffer(*cinfo.mem-alloc_sarray)((j_common_ptr)cinfo,JPOOL_IMAGE,width*depth,1);pointdst_bufferwidth*depth*(height-1);while (cinfo.next_scanlineheight){memcpy(*buffer,point,width*depth);jpeg_write_scanlines(cinfo,buffer,1);point-width*depth;}jpeg_finish_compress(cinfo);jpeg_destroy_compress(cinfo); }int main() {input_filefopen(lena_gray.bmp,rb);output_filefopen(lena.jpg,wb);read_bmp_header();read_bmp_data();synthese_jpeg();fclose(input_file);fclose(output_file);delete[] src_buffer;delete[] dst_buffer;coutgood job.endl;cin.get();return 0; } 转载于:https://www.cnblogs.com/tiandsp/archive/2012/12/03/2799561.html
http://www.fuzeviewer.com/news/24568/

相关文章:

  • 2025年口碑好的nfc标签厂家最新热销排行
  • 自己搭建视频播放网站唐山营销型网站建设
  • seo网站优化专员高效省心的app定制开发平台
  • 自适应网站一般用什么框架做网站后台无法修改
  • wordpress网站怎么加速苏州公司网站建设找哪家
  • 北京海淀区建设局网站开发微信公众
  • 网站集约化平台人防工程建设网站
  • 做几个网站好网站全栰培训
  • 中小型企业网站建设与管理考试彩票类网站是如何做代理的
  • 寿光shengkun网站建设中国行业网站联盟
  • nanopi neo做网站2345网址导航用户中心
  • 如何让chrome变成arc风格
  • 2025年专业的医养家具厂家最新TOP排行榜
  • 常德投诉网站上海中心设计公司是谁
  • 2025年口碑好的五星酒店家具厂家推荐及选购参考榜
  • 网站做宣传的免费渠道有那种php注册网站源码带数据库
  • 运动网站源码打开自己的网站是别人的域
  • 建设银行公户网站网站插件代码怎么用
  • 公司网站静态模板网站维护的作用
  • 青岛正规网站建设哪家便宜03173软件开发工具
  • wordpress生成二维码企业网站搜索优化网络推广
  • 2025年质量好的别墅电梯厂家最新TOP排行榜
  • 菠菜网站如何做推广网站域名信息
  • 福州最好的网站建设服务商网站模板代码怎么写
  • 做网站网站彩票算犯法吗成都互联网外包公司
  • 建设网站必须要服务器深圳seo网站优化公司
  • 公司网站制作招聘网站百度收录突然消失了
  • 运营好网站王烨飞变形计
  • 食品建设网站前的市场分析北京建设银行
  • 徐州网站建设找哪家好苏州做网站哪里好