Hello, dear forum users!
Recently I got the idea to implement 1 of the methods of steganography on php.
For this, I needed a function that allows you to work directly with the binary code of the image (it would be extremely inconvenient to do this through colors, each time converting the number of each color into the decimal system and back to binary). Honestly trying to find such a function on the Internet, I may be a deer, but it did not work out.
Tell me, if not difficult.
- If you do not prompt ready-made solutions, you can do so: 1. Save the image as a BMP in 16-bit color depth without compression. 2. Find out the size of the image. 3. Cut off file headers. 4. To work with the file as with a line, where one pixel is designated by 6th bytes. The structure of the format is quite well described in [Wikis] ( ru.wikipedia.org/wiki/BMP ). - ReinRaus
- It is not quite clear what is required. Open a file of any picture and work with an array of color values of its pixels? In any case, look at the files of two popular libraries for working with images in php: GD and ImageMagick - Sergiks
- I wanted to get either a string consisting purely of 1 and 0, or an array of all bytes (the key is a number, and the value is a binary number with 8 digits). Yesterday I thought and decided not to bathe and use the GD library, get the color of the pixel, and then process it. In essence, the same thing, only with a large number of intermediate actions. But thanks for the advice :) I did not even hear about ImageMagik library earlier, o_O - Selentiym
- get a string of 1 and 0 is never superfluous gestures)) - rasmisha
- Hmmm , you're right :) but it’s convenient to handle: D - Selentiym
|