this post was submitted on 20 Sep 2024
12 points (100.0% liked)

Ask Lemmy

27225 readers
1138 users here now

A Fediverse community for open-ended, thought provoking questions


Rules: (interactive)


1) Be nice and; have funDoxxing, trolling, sealioning, racism, and toxicity are not welcomed in AskLemmy. Remember what your mother said: if you can't say something nice, don't say anything at all. In addition, the site-wide Lemmy.world terms of service also apply here. Please familiarize yourself with them


2) All posts must end with a '?'This is sort of like Jeopardy. Please phrase all post titles in the form of a proper question ending with ?


3) No spamPlease do not flood the community with nonsense. Actual suspected spammers will be banned on site. No astroturfing.


4) NSFW is okay, within reasonJust remember to tag posts with either a content warning or a [NSFW] tag. Overtly sexual posts are not allowed, please direct them to either [email protected] or [email protected]. NSFW comments should be restricted to posts tagged [NSFW].


5) This is not a support community.
It is not a place for 'how do I?', type questions. If you have any questions regarding the site itself or would like to report a community, please direct them to Lemmy.world Support or email [email protected]. For other questions check our partnered communities list, or use the search function.


6) No US Politics.
Please don't post about current US Politics. If you need to do this, try [email protected] or [email protected]


Reminder: The terms of service apply here too.

Partnered Communities:

Tech Support

No Stupid Questions

You Should Know

Reddit

Jokes

Ask Ouija


Logo design credit goes to: tubbadu


founded 2 years ago
MODERATORS
 

I've noticed some files I opened in a text editor have all kinds of crazy unrenderable chars

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 3 months ago* (last edited 3 months ago) (2 children)

I just mean like any file (pdf, jpeg, mp4, mp3, exe—

mp4/mp3 most famously for me

I find it so damn cool and incredible I can record something/anything right now and open the audio in a text file and its all right there—albeit in an incomprehensible format but there altogether.

Its like a thinking rock etching sound into stone

[–] [email protected] 8 points 3 months ago* (last edited 3 months ago) (1 children)

If you're on Linux, you can convert that to something more human readable by piping it to base64. It works with any file, but I'll use an image here:

cat image.webp | base64

Which yields:

UklGRroEAABXRUJQVlA4WAoAAAAgAAAAYwAAQgAASUNDUKACAAAAAAKgbGNtcwRAAABtbnRyUkdC
IFhZWiAH6AAIABoADgAJACBhY3NwQVBQTAAAAAAAAAAAAA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OQblnpHx03lASjGlSyGbkKUD3xA5KOqgq/
VEUJ4qF9VoAYFbFhQRAgkvmREk5umMj8sr9Np95+n/oP2Aq2VW5xU4F1xpD8Vd4Dp7Phwm9w/Dnf
94djRROFRYPZeg/1Q/qiROFRVRu2nBcgndbhc0x0h+kgvT/naeJOEqwNjYPlIiw/DGuxav7+x09R
mf2mJto3ineDqfyMWUN83PmKqzGHkYGhZrTU478qjlQucDzWkwobnUmzhE6I+mDYkfiUVPcHyXbf
xXRStyPiPZAkJZrE9OrjFNUeljRQdVTQqeBsy+O9VwDLU5GcKhBQHa4cj+/DGqUhi74WH0EuHsb3
EgZVNc1FbRm5QFOpjDSprGIRYxe6sFFDrDOg4DhWZRnOa7s68pGaDDpbqrORxzPHXPbs55/1HTas
DDGzKFmTG4hJ2GUZKqjPcQ+MAAAA

Copy that into a text file and pass it to base64 with the decode flag, and you'll get the original binary:

cat data.txt | base64 -d > data.bin

Inspect it to see what kind of file it is:

file data.bin -> data.bin: RIFF (little-endian) data, Web/P image

Rename it so you can just double-click it to open it:

mv data.bin data.webp

Enjoy the surprise.

You can also print files like that, scan them using OCR, and then restore them. A very inefficient way to do backups, but it works.

[–] [email protected] 3 points 3 months ago (2 children)

How is it representing it tho? Like does it have woven in there an array of hexcode colors for every microscopic pixel that makea up the picture.

Are images and audio files just arrays of frames which are arrays of pixels and sound units?

[–] [email protected] 4 points 3 months ago* (last edited 3 months ago)

It just converts the raw binary data into character encoding, so it doesn't matter what the source is (image, video, database file, etc). The source binary data is taken 6 bits at a time, then this group of 6 bits is mapped to one of 64 unique characters.

The decoding process is just the reverse of that: mapping the data back to binary form.

https://en.wikipedia.org/wiki/Base64

[–] [email protected] 2 points 3 months ago

the answer to your how question is as needed.

some image and audio formats (especially older ones) are like that, yes. others use compression or other techniques to suit their need. like a sound can be a raw recording sample. or a sound can be described with Attack/Decay/Sustain/Release, along with octave and note etc. so a MIDI file is an audio file format without samples.

i once created an image format to be used for spiraling out images, instead of pixel arrays they were concentric circles of pixels that i could easily offset.

[–] [email protected] 1 points 3 months ago

You can use a hex editor to view those files and even change them in some cases.

Something like this https://github.com/WerWolv/ImHex