Photo to ASCII-art converter
This code converts picture files to .TXT files. Works best with photo's. Start a new project, insert a picturebox, and past the code in the code-window, HAVE FUN !!
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Sub Form_Load()
Me.Top = 0
Me.Left = 0
Picture1.ScaleMode = 3
Picture1.Top = 0
Picture1.Left = 0
Picture1.AutoSize = True
Picture1.Picture = LoadPicture("c:\windows\desktop\" & InputBox("What picture do you want to convert ? c:\windows\desktop\", "Pic2txt"))
Me.Width = Picture1.Width + 120
Me.Height = Picture1.Height + 405
Me.Show
Dim x As Integer
Dim y As Integer
Dim tempcolor As Long
Open "c:\windows\desktop\picture.txt" For Output As #1
For y = 1 To Picture1.ScaleHeight Step 2
For x = 1 To Picture1.ScaleWidth - 1
tempcolor = GetPixel(Picture1.hdc, x, y)
Print #1, Mid("#iex+..", Int((Int(tempcolor / 65536) + Int((tempcolor - Int(tempcolor / 65536) * 65536) / 256) + tempcolor - Int(tempcolor / 256) * 256) / 3 / 42.5) + 1, 1);
Next x
Picture1.PSet (2, y), vbRed
Print #1, ""
Next y
Close #1
MsgBox "Your picture is converted to: C:\WINDOWS\DESKTOP\PICTURE.TXT, use Wordpad to open it, Select All, set font size to 3, scroll up, and see what it has been converted to.", vbOKOnly, "Pic2txt"
End Sub
Original Comments (3)
Recovered from Wayback Machine