codingwheneveriwant
codingwheneveriwant
Unordered Binary
3 posts
A random stream of coding projects whenever I feel like it
Don't wanna be here? Send us removal request.
codingwheneveriwant · 2 months ago
Text
Tumblr media Tumblr media
Adding minimal UI
This is an update to my previous posts in which, I used python to turn images such as pngs and jpgs into ASCII representations. After I had finished creating and polishing the main system, I decided to add a small amount of UI just to say that I had fully finished the project and made it usable to someone who might not wants to go through the trial of finding out how to change the image, by changing the code. I also wanted it to be faster and more fool-proof so that I don't run into problems while showing someone and put myself in an awkward situation where I'm fixing it while showing it off.
The UI I added was pretty simple and purely text-based, as I already know how to do this and don't want to create more potential bugs, which would be opposite of my aim.
The first thing I did was add a system to choose exactly which image to transfer, this would just be the images I have already added and tested. Such as the Miles Teller image. I used numbers so that people can choose the options with little confusion, also adding an error message if someone types something other than the pre-set options.
The next thing I added was an option to compress or not, so that the user has full control. I used y or n options this, just for simplicity.
One thing I noticed while testing was that if you save images from discord, they have an alpha value as well as rgb. This messes up this line of code: "r, g, b = pixel" which unpacks the rgb values from the pixel array, but with the added alpha value, it returns and error as not all of the values in the array are accounted for. To fix this, I literally just added an if statement that, if the image is from discord, instead of using the previously shown line of code, it does "r, g, b, x = pixel" the x is never used, but its just an easy way to remove the error.
Tumblr media
0 notes
codingwheneveriwant · 2 months ago
Text
Tumblr media Tumblr media
Image to ASCII (No compression)
This is a follow up to my previous post, about the image to ASCII converter. In that post, I mentioned that I use a method, much like compression, that only converts every other pixel of every other row. Here I just wanted to show an example of no compression.
1 note · View note
codingwheneveriwant · 2 months ago
Text
Tumblr media Tumblr media
Image to ASCII converter
Honestly, I had no clue if I would be able to do this; I've mainly stuck to projects you can do with just standard python, as the difficulty of recommended projects went from stuff you could teach a child to do, to stuff without proper documentation. However, this project was completed within 1 hour with minimal checks on the internet, and I think it went pretty well to say this is one of my first usages of modules (apart from discord bots).
For this project, I just wanted it to work so it isnt theb est and the light to ASCII vslues are just my first guesses; so it's safe to assume that this could be greatly improved. The little refining I did, was making the reader only check every other pixel on every other row, basically compression but for ASCII.
DM me if you would like to know how I did it or want help on it.
3 notes · View notes