快捷登录,享 免费下载
首页 > 教程资讯 > 教程详情

AnyToBMP的教程

补充锦囊 完美下载小客服 2021-03-30
文章分享
软件首页

完美者(wmzhe.com)网站以软件下载为基础,改版后的网站对功能性板块进行扩充,以期能够解决用户在软件使用过程中遇见的所有问题。网站新增了“软件百科”、“锦囊妙技”等频道,可以更好地对用户的软件使用全周期进行更加专业地服务。

【基本简介】

重要文件加密的方法有很多种,例如:winrar压缩加密,加密软件等,但将文件隐藏到一副图片里面,一般人想不到里面有文件隐藏着吧,哇哈哈!将文件隐藏到一副图片的方法很多,常见的有以下三种方法:

1、将文件写入到图片的尾部,这个方法比较简单,效果也还不错,但有时候比较容易露馅儿,比如图片的分辨率明明很低但是文件却有好几兆大小。

2、在不影响图片整体效果的前提下修改特定比特位,实现将文件隐藏的效果。这种方法隐藏的效果是最好的,但缺点是隐藏的内容很有限,而且能隐藏文件的大小和图片的内容也有关系。

3、在保留位图头文件的前提下替换位图的数据为所要隐藏的数据,缺点是生成的文件是杂乱的,由一个个杂色点所组成的图片,没有任何意义的图片。

这三种方法是最常见的,而我的方法与这些都不同,主要的优点是图片的体积近乎等于所隐藏文件的体积,而且分辨率随着文件大小的而变化,完全符合图片格式规范……

首先介绍一下隐藏的原理吧:

BMP文件头 | BMP信息头 | 调色板 | 文件后缀 | 文件长度 | 图片数据

各部分所代表的含义就不做详细说明了,有兴趣的同学可以去查询相关资料。为什么要介绍位图文件的结构呢,因为我的隐藏方法需要对这里的调色板做手脚……

这样我们看到的图片才是五彩斑斓的。但是如果我们把这个调色板里所有的颜色都设定为同一种颜色,如下图,那会怎么样??

大家应该已经猜到了,图片不再是五彩斑斓的了,而是变成了一幅纯色的图片,不管图片数据区的内容如何修改,这都是一幅纯色的图片,说到这里,大家有明白隐藏文件的方法没?

好了,原理就讲到这里了,理解也好没理解也罢,直接给出程序。

程序很简单,点浏览选择你要隐藏的文件,点颜色选择输出图片的颜色,然后点开始就可以了,下方会有进度条提示转换进度。程序根目录下还有一个由4096个0和1组成的名为zw.txt的文件,这个文件你可以认为是一个密码,因为这个程序在隐藏数据的同时还对数据进行了加密,加密的算法是我在大学的时候和几个同学一起设计的一种基于MD5和矩阵变换的算法,如果zw.txt的内容和加密时不同是无法解密的。

zw.txt的内容可以修改,但必须只能由0和1组成,且固定4096个。

点击开始之后就会在所选文件目录生成一个同名的bmp文件,如果要提取文件操作相同,只不过选取的文件是加密后的文件而已。

加密后的文件类似下图,只不过颜色可以由你自己决定。隐藏文件的大小直接决定了最后输出图像文件的大小。怎么样,隐藏的还是比较深的吧,仅仅是一幅纯色的图片,谁又知道他其实别有洞天呢……

别把zw.txt丢啦,否则不能运行.

"锦囊妙技"栏目是聚合全网软件使用的技巧或者软件使用过程中各种问题的解答类文章,栏目设立伊始,小编欢迎各路软件大神朋友们踊跃投稿,在完美者平台分享大家的独门技巧。

本站文章素材来源于网络,大部分文章作者名称佚失,为了更利于用户阅读和使用,根据需要进行了重新排版和部分改编,本站收录文章只是以帮助用户解决实际问题为目的,如有版权问题请联系小编修改或删除,谢谢合作。

AnyToBMP

AnyToBMP

软件大小:81.20 KB

高速下载

相关问答

更多
  • vb的ListImages控件把bmp转成ico的代码

    按如下操作可以实现BMP、ICO互转。首先,建立如下工程 picture控件:picImage picMaskbackcolor属性分别为黑色和白色其他四个picture控件从上到下,从左到右名称依次为默认值按键从左到右为Command1和Command2在form1中输入以下代码:Option ExplicitPrivate Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, _ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, _ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As LongPrivate Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, _ByVal nWidth As Long, ByVal nHeight As Long) As LongPrivate Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As LongPrivate Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, _ByVal hObject As Long) As LongPrivate Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As LongPrivate Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As LongPrivate Declare Function CreateIconIndirect Lib "user32" (icoinfo As ICONINFO) As LongPrivate Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (lppictDesc As _pictDesc, riid As Guid, ByVal fown As Long, ipic As IPicture) As LongPrivate Declare Function GetIconInfo Lib "user32" (ByVal hIcon As Long, _icoinfo As ICONINFO) As LongPrivate Declare Function SetBkColor Lib "gdi32" (ByVal hdc As Long, _ByVal crColor As Long) As LongPrivate Declare Function CreateBitmap Lib "gdi32" (ByVal nWidth As Long, ByVal nHeight _As Long, ByVal nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As LongPrivate Type ICONINFOfIcon As LongxHotspot As LongyHotspot As LonghBMMask As LonghBMColor As LongEnd TypePrivate Type GuidData1 As LongData2 As IntegerData3 As IntegerData4(7) As ByteEnd TypePrivate Type pictDesccbSizeofStruct As LongpicType As LonghImage As LongxExt As LongyExt As LongEnd TypeConst PICTYPE_BITMAP = 1Const PICTYPE_ICON = 3Dim iGuid As GuidDim hdcMonoDim bmpMonoDim bmpMonoTempConst stdW = 32Const stdH = 32Dim mresultPrivate Sub Form_Load()hdcMono = CreateCompatibleDC(hdc)bmpMono = CreateCompatibleBitmap(hdcMono, stdW, stdH)bmpMonoTemp = SelectObject(hdcMono, bmpMono)With iGuid.Data1 = &H20400.Data4(0) = &HC0.Data4(7) = &H46End WithEnd SubPrivate Sub command1_Click()On Error Resume NextDim mtransp As LongpicImage.BackColor = Picture1.BackColormtransp = Picture1.Point(0, 0)CreateTransparent Picture1, picImage, mtranspCreateMask_viaMemoryDC picImage, picMaskmresult = BitBlt(Picture2.hdc, 0, 0, stdW, stdH, picMask.hdc, 0, 0, vbSrcAnd)mresult = BitBlt(Picture2.hdc, 0, 0, stdW, stdH, picImage.hdc, 0, 0, vbSrcInvert)BuildIcon Picture2SavePicture Picture2.Picture, App.Path & "/Frombmp.ico"End SubPrivate Sub command2_Click()On Error Resume NextDim i, jDim p, qPicture4.Picture = Picture3.Imagep = Picture4.Point(0, 0)q = Me.BackColorFor i = 0 To stdWFor j = 0 To stdHIf Picture4.Point(i, j) = p ThenPicture4.PSet (i, j), qEnd IfNext jNext iSavePicture Picture4.Picture, App.Path & "/Fromico.bmp"End SubPrivate Function CreateMask_viaMemoryDC(Pic1 As PictureBox, Pic2 As PictureBox) As BooleanOn Error GoTo errHandlerCreateMask_viaMemoryDC = FalseDim dx As Long, dy As LongDim hdcMono2 As Long, bmpMono2 As Long, bmpMonoTemp2 As Longdx = Pic1.ScaleWidthdy = Pic1.ScaleHeighthdcMono2 = CreateCompatibleDC(0)If hdcMono2 = 0 ThenGoTo errHandlerEnd IfbmpMono2 = CreateCompatibleBitmap(hdcMono2, dx, dy)bmpMonoTemp2 = SelectObject(hdcMono2, bmpMono2)mresult = BitBlt(hdcMono2, 0, 0, dx, dy, Pic1.hdc, 0, 0, vbSrcCopy)mresult = BitBlt(Pic2.hdc, 0, 0, dx, dy, hdcMono2, 0, 0, vbSrcCopy)Call SelectObject(hdcMono2, bmpMonoTemp2)Call DeleteDC(hdcMono2)Call DeleteObject(bmpMono2)CreateMask_viaMemoryDC = TrueExit FunctionerrHandler:MsgBox "MakeMask_viaMemoryDC"End FunctionPrivate Sub ExtractIconComposite(inPic As PictureBox)On Error Resume NextDim ipic As IPictureDim icoinfo As ICONINFODim pDesc As pictDescDim hDCWorkDim hBMOldWorkDim hNewBMDim hBMOldMonoGetIconInfo inPic.Picture, icoinfohDCWork = CreateCompatibleDC(0)hNewBM = CreateCompatibleBitmap(inPic.hdc, stdW, stdH)hBMOldWork = SelectObject(hDCWork, hNewBM)hBMOldMono = SelectObject(hdcMono, icoinfo.hBMMask)BitBlt hDCWork, 0, 0, stdW, stdH, hdcMono, 0, 0, vbSrcCopySelectObject hdcMono, hBMOldMonoSelectObject hDCWork, hBMOldWorkWith pDesc.cbSizeofStruct = Len(pDesc).picType = PICTYPE_BITMAP.hImage = hNewBMEnd WithOleCreatePictureIndirect pDesc, iGuid, 1, ipicpicMask = ipicSet ipic = NothingpDesc.hImage = icoinfo.hBMColorOleCreatePictureIndirect pDesc, iGuid, 1, ipicpicImage = ipicDeleteObject icoinfo.hBMMaskDeleteDC hDCWorkSet hBMOldWork = NothingSet hBMOldMono = NothingEnd SubPrivate Sub BuildIcon(inPic As PictureBox)On Error Resume NextDim hOldMonoBMDim hDCWorkDim hBMOldWorkDim hBMWorkDim ipic As IPictureDim pDesc As pictDescDim icoinfo As ICONINFOBitBlt hdcMono, 0, 0, stdW, stdH, picMask.hdc, 0, 0, vbSrcCopySelectObject hdcMono, bmpMonoTemphDCWork = CreateCompatibleDC(0)With inPichBMWork = CreateCompatibleBitmap(inPic.hdc, stdW, stdH)End WithhBMOldWork = SelectObject(hDCWork, hBMWork)BitBlt hDCWork, 0, 0, stdW, stdH, picImage.hdc, 0, 0, vbSrcCopySelectObject hDCWork, hBMOldWorkWith icoinfo.fIcon = 1.xHotspot = 16.yHotspot = 16.hBMMask = bmpMono.hBMColor = hBMWorkEnd WithWith pDesc.cbSizeofStruct = Len(pDesc).picType = PICTYPE_ICON.hImage = CreateIconIndirect(icoinfo)End WithOleCreatePictureIndirect pDesc, iGuid, 1, ipicinPic.Picture = LoadPicture()inPic = ipicbmpMonoTemp = SelectObject(hdcMono, bmpMono)DeleteObject icoinfo.hBMMaskDeleteDC hDCWorkSet hBMOldWork = NothingEnd SubSub CreateTransparent(inpicSrc As PictureBox, inpicDest As PictureBox, _inTrasparentColor As Long)On Error Resume NextDim mMaskDC As LongDim mMaskBmp As LongDim mTempMaskBMP As LongDim mMonoBMP As LongDim mMonoDC As LongDim mTempMonoBMP As LongDim mSrcHDC As Long, mDestHDC As LongDim w As Long, h As Longw = inpicSrc.ScaleWidthh = inpicSrc.ScaleHeightmSrcHDC = inpicSrc.hdcmDestHDC = inpicDest.hdcmresult = SetBkColor&(mSrcHDC, inTrasparentColor)mresult = SetBkColor&(mDestHDC, inTrasparentColor)mMaskDC = CreateCompatibleDC(mDestHDC)mMaskBmp = CreateCompatibleBitmap(mDestHDC, w, h)mTempMaskBMP = SelectObject(mMaskDC, mMaskBmp)mMonoDC = CreateCompatibleDC(mDestHDC)mMonoBMP = CreateBitmap(w, h, 1, 1, 0)mTempMonoBMP = SelectObject(mMonoDC, mMonoBMP)mresult = BitBlt(mMonoDC, 0, 0, w, h, mSrcHDC, 0, 0, vbSrcCopy)mresult = BitBlt(mMaskDC, 0, 0, w, h, mMonoDC, 0, 0, vbSrcCopy)mMonoBMP = SelectObject(mMonoDC, mTempMonoBMP)mresult = DeleteObject(mMonoBMP)mresult = DeleteDC(mMonoDC)mresult = BitBlt(mDestHDC, 0, 0, w, h, mSrcHDC, 0, 0, vbSrcInvert)mresult = BitBlt(mDestHDC, 0, 0, w, h, mMaskDC, 0, 0, vbSrcAnd)BitBlt mDestHDC, 0, 0, w, h, mSrcHDC, 0, 0, vbSrcInvertinpicDest.Picture = inpicDest.ImagemMaskBmp = SelectObject(mMaskDC, mTempMaskBMP)mresult = DeleteObject(mMaskBmp)mresult = DeleteDC(mMaskDC)End SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)SelectObject bmpMono, bmpMonoTempDeleteObject bmpMonoDeleteDC hdcMonoEnd Sub