绿色风's Blog
专注AutoIT(Au3)
  • 首页
  • 流●年
  • 笔●记
    • 学习随记
    • 源码示例
  • 脚●本
    • UDF(收集)
    • 工作室UDF
    • 工具●教程
    • 教程之GDI
  • 作●品
  • 下●载
  • 情怀ExcelTip
12月202016

AU3 图片读入数组后输出回图片文件

作者:绿色风   发布:2016-12-20 12:18 Tuesday   分类:学习随记   阅读:5557次   评论:0条  

转载收藏

阿福的图片读入数组后  输出回图片文件··


```Func _myWriteArrayToBmpFile($func_array, $s_newFile) If UBound($func_array)=0 Or UBound($func_array,3)>0 Then Return "" If StringLower(StringRight($s_newFile,4))<>".bmp" Then $s_newFile &=".Bmp";只支持Bmp FileDelete($s_newFile) If FileExists($s_newFile) Then Return "";不可写' If UBound($func_array,2)=0 Then;一维数组 Local $i_height = UBound($func_array) ;高 Local $i_width = StringLen($func_array[0])/6 ;宽 Else;二维数组 Local $i_height = UBound($func_array,2) ;高 Local $i_width = UBound($func_array);宽 EndIf Local $head=DllStructcreate("ubyte[54]") Local $Bmpheader = DllStructCreate("align 1;char BM[2];uint Size;uint res;uint Offset;uint BMHI;uint Width;uint Height;short Planes;"& _ "short BPP;uint BIcomp;int SizeImg;uint reshor;uint resver;uint col;uint colused", dllstructgetptr($head)) Local $iLen=$i_width*$i_height*3 DllStructSetData($bmpheader,"BM","BM") DllStructSetData($bmpheader,"Size",54+$iLen) DllStructSetData($bmpheader,"Offset",54) DllStructSetData($bmpheader,"BMHI",40) DllStructSetData($bmpheader,"Width",$i_width) DllStructSetData($bmpheader,"Height",-$i_height) DllStructSetData($bmpheader,"Planes",1) DllStructSetData($bmpheader,"BPP",24) DllStructSetData($bmpheader,"BIcomp",0) Local $header = dllstructgetdata($head,1) ;headerdata Local $filehandle = FileOpen($s_newFile, 18) ;write file FileWrite($filehandle,$header) Local $s_bott="",$i For $i = 1 To Mod($i_width,4) $s_bott &= "0" Next ;ConsoleWrite($s_bott&@CRLF) Local $y If UBound($func_array,2)=0 Then For $y=0 To $i_height-1 FileWrite($filehandle,"0x"&$func_array[$y]) FileWrite($filehandle,$s_bott) Next Else Local $x For $y=0 To $i_height-1 For $x=0 To $i_width-1 FileWrite($filehandle,"0x"&$func_array[$x][$y]) Next FileWrite($filehandle,$s_bott) Next EndIf FileClose($filehandle) If FileExists($s_newFile) Then Return $s_newFile Else Return "" EndIf EndFunc```





本文固定链接: http://www.jianyiit.com/post-249.html

blogger
该日志由 绿色风 于2016-12-20 12:18 Tuesday发表在 学习随记 分类下。
版权所有:《绿色风's Blog》 → 《AU3 图片读入数组后输出回图片文件》;
除特别标注,本博客很多文章均为原创. 互联分享,尊重版权,转载请以链接形式标明本文地址;
本文标签:

扫描二维码,在手机上阅读
上一篇::AU3真正的 修改IE 代理 即使生效·
下一篇:二十世纪最伟大的10大算法

热门文章

相关文章

  • 程序获取IE版本的方法
  • ListView列表视图框中焦点的鼠标事件
  • Windows消息代码
  • 键盘鼠标参数表
  • CSS样式_做个笔记
取消回复

发表评论

亲,头像对么?

77 + 44 =

提交中,请稍候……


木有头像就木JJ啦!还木有头像吗?点这里申请属于你的个性Gravatar头像吧!


    站点统计
    • 运行时间: 20254 天
    • 日志总数: 365 篇
    • 评论数量: 7238 条
    • 微语数量: 6 条
    • 附件总量: 388 件
  • 逝出的青春

  • 打赏"绿色风"



      扫码关注本站公众号 可搜本站内容

  • Autoit V3 脚本交流群

      常驻群1:905774875
      常驻群2:40672266


  • 链接

    • AU3中文论坛
    • Excel资料库
    • 完美者博客
    • 顺网小哥'S Blog
    • 猛牛哥的博客
    • 网吧系统下载
  • 分类

    • 流●年(66)
    • 笔●记(0)
    • 脚●本(0)
    • 作品(21)
    • 学习随记(51)
    • 源码示例(68)
    • UDF(收集)(26)
    • 工作室UDF(30)
    • 工具●教程(62)
    • 教程之GDI(24)
Copyright © 2013 绿色风's Blog. Powered by emlog. Theme by 射雕天龙. 鄂ICP备2021011689号-1 鄂公网安备42102302000078号 sitemap