请问使用什么工具可将图片转换为数组?
FileName=fileDlg.GetFileName ();FILE *fp=fopen(FileName,"rb");//二进制读方式打开指定的图像文件fread(&FileHead, sizeof(BITMAPFILEHEADER), 1,fp); //读取文件头,文件指针自动后移fread(&InfoHead, sizeof(BITMAPINFOHEADER), 1,fp);//读取信息头,文件指针自动后移//获取图像宽、高、每像素所占位数等信息bmpWidth = InfoHead.biWidth;bmpHeight = InfoHead.biHeight;//下面完成图像数据向内存数组的存储ImageData=new unsigned char*[bmpHeight];if(InfoHead.biBitCount==24){for (int i=0;i<bmpHeight;i++){ImageData[i]=new unsigned char[(bmpWidth*3+3)/4*4];}for (int k=0;k<bmpHeight;k++ ){for(int j=0;j<(bmpWidth*3+3)/4*4;j++){fread(&ImageData[k][j],1,1,fp);//上面完成动态二维数组的申请,这里实际读取图像数据}}fclose(fp);//关闭文件...
如何将bmp图像转化成数组
1、步骤大概这样第一步:读取图像数据到内存第二步:读取文件头第三步:读取信息头第四步:读取图像矩阵到二维数组2、例程:FileName=fileDlg.GetFileName ();FILE *fp=fopen(FileName,"rb");//二进制读方式打开指定的图像文件fread(&FileHead, sizeof(BITMAPFILEHEADER), 1,fp); //读取文件头,文件指针自动后移fread(&InfoHead, sizeof(BITMAPINFOHEADER), 1,fp);//读取信息头,文件指针自动后移//获取图像宽、高、每像素所占位数等信息bmpWidth = InfoHead.biWidth;bmpHeight = InfoHead.biHeight;//下面完成图像数据向内存数组的存储ImageData=new unsigned char*[bmpHeight];if(InfoHead.biBitCount==24){for (int i=0;i{ImageData[i]=new unsigned char[(bmpWidth*3+3)/4*4];}for (int k=0;k{for(int j=0;j{fread(&ImageData[k][j],1,1,fp);//上面完成动态二维数组的申请,这里实际读取图像数据}}fclose(fp);//关闭文件
有什么软件可以批量把jpg的图片转为gif或者其它容量更小的格式?
response.setContentType( "iamge/jpg "); ServletOutputStream sos = response.getOutputStream(); ResultSet rs = stmt.executeQuery( "select imagefield from t "); while(rs.next()){ InputStream is = rs.getBinaryStream( "imagefield "); byte[] b = new byte[128]; int l; while((l = is.read(b))>-1){ sos.write(b,0,l); } }