Invisible Ink Picture (Source Included)
BlitzMax Forums/BlitzMax Programming/Invisible Ink Picture (Source Included)
| ||
Having received a Secret Invisible Ink pen I ordered from Ebay recently, I got to thinking about ALPHA transparency and came up with this interesting idea of hiding pictures online. They appear invisible to everyone else, but if you save them, they can be revealed later. Here is the code to do it: ' Invisible Ink Picture by David W (dw817) 12-29-15 Strict Global i,j,c,typ,pic:TPixmap,pic2:TPixmap,img:TImage,view$,hide$ Typ=1 ' 0=Convert a picture to invisible ink and save it ' 1=Reveal a saved Invisible Ink picture SetGraphicsDriver(GLMax2DDriver()) ' NECESSARY FOR AGGRESSIVE PIXEL READING & WRITING Graphics 640,480 view$="spy-normal.png" hide$="spy-hidden.png" If typ pic=LoadPixmap(hide$) DrawPixmap pic,0,0 Flip WaitKey End EndIf pic=LoadPixmap(view$) pic2=CreatePixmap(128,128,pf_rgba8888) For i=0 To 127 For j=0 To 127 c=ReadPixel(pic,j,i)-$ff000000 WritePixel(pic2,j,i,c) Next Next img=LoadImage(pic2) DrawImage img,0,0 If typ=0 SavePixmapPNG pic2,hide$,9 EndIf Flip WaitKey End And here is your secret picture: It's there ! Just click and save it as, "spy-hidden.png" and run the program. |