I interested to work with data types and file formats.
For example I want to open a jpeg file with php and work with it.
For example get the size, or change it to black and white without any library.
I want to know that how can decode bytes of a file and get information about it?
I opened a jpeg file with HxD and saw some data in hexadecimal.
Please give me a reference to know more about files and structures…
Sorry for bad English.
Thanks a lot …
I interested to work with data types and file formats. For example I want
Share
A lot of image files are encoded using the Exchangeable Image File Format
In PHP you could use something like this method:
http://php.net/manual/en/function.exif-read-data.php
That will allow you to have access to the different properties of an image which are stored in the image header, such as resolution, endianess, etc. which you can then use to read in the raw image data.
The raw image data is usually stored immediately after the image header.
Here is the spec for the Jpeg File Interchange Format (JFIF):
http://www.jpeg.org/public/jfif.pdf
Also, in PHP if you’re just reading raw image data you would use:
and you can then display it in a browser using: