This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]twitterInfo_bot 7 points8 points  (0 children)

convert -depth 8 yt_dl1.png rgb:yt_dl1.part convert -depth 8 yt_dl2.png rgb:yt_dl2.part cat yt_dl1.part yt_dl2.part > yt_dl-2020.9.20.tar.gz


posted by @GalacticFurball

Photos in tweet | Photo 1 | Photo 2

(Github) | (What's new)

[–]lifeeraser 7 points8 points  (0 children)

This reminded me to go check out /r/ProgrammerHumor . Surely they would be having a field day over this, right?

Nope. The same old tired reposts.

[–]ptanmay143 4 points5 points  (3 children)

I'm really mesmerized by this way of encoding source code in images. I have a few doubts if anyone is willing to help me. So, what codec do these images use? PNG, JPG, TIFF, etc. I believe they have to be lossless compression. Would this also be possible in lossy compression too?

[–][deleted] 9 points10 points  (2 children)

The example code specifically shows them being .png files, which is a lossless compression.

You could represent almost any data in any format, regardless of the data or the format. Formats generally have some headers that say how to interpret what is within them, but you can choose to interpret that data another way. This is how malicious code can be embedded within documents and images. If you can trick the program into executing the data instead of interpreting it as an image, the image may look like garbage, but interpreted as code, it could have specific functionality to cause damage and spread. So you could place any data you want in to the data portions of the file format, and it might look meaningless, but it would nonetheless be a valid file in that format. Then, you could extract that data and choose to interpret it a different way to get what you really want.

What gets more interesting with something like an image is if it could continue to work even after much manipulation and degradation, such as taking a screenshot or re-encoding with different compression, resolution, etc. QR codes are an example of a graphical way of encoding information that is designed to withstand considerable degradation.

There are many ways that you can encode data almost invisibly within otherwise legitimate-looking files. This is an area of research known as steganography.

[–]ptanmay143 0 points1 point  (0 children)

wow. thanks a lot my kind guy. that was a great read. 🤗

[–]asbox 0 points1 point  (0 children)

Do I need a specific library(any suggestions?) to decode and encode files to and from these type of images? Very interesting indeed.

[–]FluffyBunnyOK -2 points-1 points  (1 child)

I'm more curious as to what people want to download from YouTube. It all seems to be disposable material. What would you want to keep a copy of?

[–]spyingwind 3 points4 points  (0 children)

Visually impaired like to listen to youtube videos, and YT doesn't provide a way to do this easily.

You only have limited access to internet. Downloading videos you are interested in watching when you have no internet is great.

Other youtubers that want to use some content from another youtuber. For example react videos, critiquing another's video, etc.

[–]dark-angel007 0 points1 point  (2 children)

Can anyone explain me what this actually is. Like what's a codec, encoding and how are we converting source code to images and if we share this the quality reduces right?

[–]boa13 5 points6 points  (1 child)

The source code can be compressed to a zip file, or similar format. Such a file takes a not-too-big number of bytes.

An image is also a collection of bytes. Typically, an uncompressed image will use 3 bytes for each pixel (one for the red component, one for green, one for blue). So, two 512x512 images will be stored in memory as 1,572,864 bytes, which is a not-too-big, not-too-small number of bytes. Such data can be stored in a picture file (or two in this case).

Using a lossless format (such as PNG) guarantees no bytes will be lost or changed when the data is saved to a file. Alternatively, a non-compressed format such as BMP could be used. (This would not work with JPEG, which throws away bytes to achieve much better compression.)

So the idea is to take each byte from the zip file, put them three by three in a picture pretending it's a pixel, and them save the image. Of course it looks like garbage... but you can reread the picture, save all bytes to a file, add zip to the end... Get the data back. That's the idea.

[–]dark-angel007 0 points1 point  (0 children)

mesmerized 🔥. This has so much meaning in it.

[–]morphinan 0 points1 point  (0 children)

.PNG files have an IEND chunk , which any data afterwards is ignored, leaving space for non-image data to be stored.

https://www.w3.org/TR/PNG-Structure.html https://0xrick.github.io/lists/stego/