I was wondering if anyone here has skill under their belt in designing, and working with multiple image file formats in computer programming.
For example, a .JPEG would be different than a .BMP in Windows, but share some alikeness.
Is it the binary data within that designates difference, or is it merely a standardized format that is loaded by dedicated image loading software?
Let's say, basically, a program like Microsoft Paint, regardless of version, will decode the binary data of an image file format, and show it on the canvas.
But what designates it? Is it binary data, file header info, metadata, etc.?
How does the program dictate the differences, unless they have different data?
If I made my own image format, I'd need to add-on to existing data, correct?
Either that or start from scratch, which is never easy....
PS: Why do I ask? I'm developing an operating system, painfully and slowly but working out thus far and learning constantly ... I can't use any already existing standardized image file formats or extensions, so I'd need to make up my own for testing purposes.
In most operating systems, there are only four ways you can know what format a file's contents are:
-File extension
-Header info/magic number at start of file
-Context of use
-Guess
Different image forums are used for depending on whichever is most advantageous for a goal. BMP is quick and easy to deal with and lossless, PNG is compressed and lossless and should always be used, JPEG is lossy but great for compressing real life images, GIF is horrible and should never be used, APNG is animated PNG like MNG but more poplar, and LB is very opinionated.
Windows for example will probably use the file extension and metadata to determine the file type and to associate an appropriate application to open it with. But said application should check the header to determine the exact image type, bit depth, etc...
Most files start with a number/string that allows programs to verify their format. ELF executables on Linux, for example, start with the string "\7fELF" (\7f means the hexadecimal constant 0x7f).