Jump to content

Hiding programs in pixels


Recommended Posts

Computer and Console seemed only to have to do with games , same for developer corner. So I think this would be the better forum because the program(s) i share is not a game, but can certaintly take apps and put them into pixels.





I wrote a program. That converts a program's bytes. Into pixel values. I wrote a program. That is also the same program that deconverts program's bytes... into a program.


An image can store a program.

0 - 255 easily done in a single pixel.


1024x1024 image can hold ~1MB of data.


We store our programs in pixels. But we can also use any range of 255. Masking ourselves from those antivirus mad men. To hide our programs or not to !


Now this has been shared. I share the source. I took a big risk sharing something without googling if others have done it. i like to believe i am special.

#include <Windows.h>
#include "BitmapHelp.h"
#include <GdiPlus.h>
#include <fstream>
using namespace std;
const int imageW = 1024;
const int imageH = 1024;
bool bRunning = false;
BYTE* openBinaryForData(char* filePath, int &byteTotal);
void saveBinaryData(char* filePath, BYTE* fileData, int byteTotal);
void WriteLengthToFile(char* filePath, int nVal);
int ReadLengthFromFile(char* filePath);
void Convert();
void DeConvert();
LRESULT CALLBACK OurWindowProcedure(HWND han_Wind,UINT uint_Message,WPARAM parameter1,LPARAM parameter2)
  // 1. Convert app to image
  // 2. DeConvert image back to app
  bRunning = false;
return DefWindowProc(han_Wind,uint_Message,parameter1,parameter2);
HWND NewWindow(LPCTSTR str_Title,int int_XPos, int int_YPos, int int_Width, int int_Height)
WNDCLASSEX wnd_Structure;
wnd_Structure.cbSize = sizeof(WNDCLASSEX);
wnd_Structure.style = CS_HREDRAW | CS_VREDRAW;
wnd_Structure.lpfnWndProc = OurWindowProcedure;
wnd_Structure.cbClsExtra = 0;
wnd_Structure.cbWndExtra = 0;
wnd_Structure.hInstance = GetModuleHandle(NULL);
wnd_Structure.hIcon = NULL;
wnd_Structure.hCursor = NULL;
wnd_Structure.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
wnd_Structure.lpszMenuName = NULL;
wnd_Structure.lpszClassName = "WindowClassName";
wnd_Structure.hIconSm = LoadIcon(NULL,IDI_APPLICATION);
return CreateWindowEx(WS_EX_CONTROLPARENT, "WindowClassName", str_Title, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE, int_XPos, int_YPos, int_Width, int_Height, NULL, NULL, GetModuleHandle(NULL), NULL);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPreviousInstance,LPSTR lpcmdline,int nCmdShow)
using namespace Gdiplus;
HWND han_Window = NewWindow("ImageTest", 100,100, imageW, imageH);
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
bRunning = true;
MSG msg_Message;
while(bRunning == true)
return 0;
BYTE* openBinaryForData(char* filePath, int& byteTotal)
BYTE* pData;
ifstream inf(filePath, ios::in | ios::binary);
inf.seekg(0, ios::end);
int nLength = inf.tellg();
pData = new BYTE[nLength];
inf.seekg(0, ios::beg);
inf.read((char*)pData, nLength);
byteTotal = nLength;
return pData;
void saveBinaryData(char* filePath, BYTE* fileData, int byteTotal)
ofstream ofs(filePath, ios::out | ios::binary);
for (int iii = 1; iii < byteTotal; ++iii)

void Convert()
using namespace Gdiplus;
HWND hwnd = FindWindow("WindowClassName", "ImageTest");
HDC hdc = GetDC(hwnd);
// Begin get binary executable bytes
int byteTotal = 0;
BYTE* pBinaryData = openBinaryForData("test.exe", byteTotal);
WriteLengthToFile("linfo.txt", byteTotal);
// End get binary executable bytes

HDC hdcMem = CreateCompatibleDC(hdc);
BYTE* pBits = 0;
HBITMAP hBmp = CreateCompatibleBitmap(hdc, imageW, imageH);

SelectObject(hdcMem, hBmp);
COLORREF colorBG = RGB(0, 255, 255);
FloodFill(hdc, 0, 0, colorBG);
FloodFill(hdcMem, 0, 0, colorBG);
// Copy over bytes to pixels
int Row = 0;
int Col = 0;
for (int iii = 0; iii < byteTotal; ++iii)
 BYTE b = pBinaryData[iii];
 COLORREF color = RGB(b, 0, 0);
 if (Row == imageW) {
  Row = 0;
 SetPixel(hdcMem, Row, Col, color);
BitBlt(hdc, 0, 0, imageW, imageH, hdcMem, 0, 0, SRCCOPY);

bmi = CreateBitmapInfoStruct(hwnd, hBmp);
CreateBMPFile(hwnd, "TestImage.bmp", bmi, hBmp, hdc);

ReleaseDC(hwnd, hdcMem);
ReleaseDC(hwnd, hdc);

delete [] pBinaryData;

MessageBox(0, "ConvertToImage", "Done", MB_OK);
void DeConvert()
using namespace Gdiplus;
HWND hwnd = FindWindow("WindowClassName", "ImageTest");
HDC hdc = GetDC(hwnd);

Bitmap* bmp = new Bitmap(L"TestImage.bmp", true);
BYTE* pData = new BYTE[imageW * imageH];
int nToWrite = 0;
int row = 0;
int col = 0;
nToWrite = ReadLengthFromFile("linfo.txt");

for (int iii = 0; iii < imageW * imageH; ++iii)
 Gdiplus::Color colour;
 bmp->GetPixel(row, col, &colour);

 pData[iii] = colour.GetRed();
 BYTE rVal = pData[iii];

 if (row == imageW) {
  row = 0;

nToWrite = nToWrite + 1;
saveBinaryData("test.exe", pData, nToWrite);
ReleaseDC(hwnd, hdc);
MessageBox(0, "DeconvertToBinary", "done", MB_OK);
delete bmp;
delete [] pData;
void WriteLengthToFile(char* filePath, int nVal)
ofstream ofs(filePath, ios::out);
ofs << nVal;
int ReadLengthFromFile(char* filePath)
int nVal = 0;
ifstream inf(filePath, ios::in);
inf >> nVal;
return nVal;

?I compile the program for you. With optin to deconvert on, press a key it will create the gw.setup.exe.


?ImageTest.exe. (I press l in window one opened, any key would probably do)

?I use multibyte character set . no angry please.


The Deconverter (pixels/image to app)



?The program

?The image for guild wars setup

?a tex t file dtailing how large the exeuctable for guild wars is suppose to be.

The converter (app to image/pixels)



The program

test.exe (gw setup)


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...