img2txt - convert a jpg to ascii

Post your nifty GP projects here!

Moderator: MSandro

Post Reply
manyone
Posts: 23
Joined: Nov 5th, '17, 07:56

img2txt - convert a jpg to ascii

Post by manyone » Nov 9th, '18, 07:49

i know this project is kind of "retro" but i have always been fascinated how they did this stuff in the old days. I was excited to find out that i was able to do it in GP. I translated the basic code from a project i saw in github (https://github.com/hit9/img2txt) and recoded it into GP.
to use it, open the images tab in the workspace and drag an image into it (something around 300x500 pixels) then go back to scripts tab and click the copy costume segment after you've selected the image from the dropdown. then click the other segment (keep the aspect ratio and maxlen for now) to perform the resizing and final rendering. the final output (html) will show up as img2txt.html in the folder where you started GP. Enjoy!
img2txt.gpp
corrected newsize block
(916.64 KiB) Downloaded 27 times
corrected so the newsize block always returns integers.
img2txt2.gpp
this version can be exported as an EXE app
(416.88 KiB) Downloaded 24 times
the new version allows a file name to be entered (must be PNG). it can also be exported to an app. the input and output are assumed to be in the same directory as the EXE.
Attachments
img2txt0.jpg

Post Reply