I’m working on a new image format. I’m pretty sure the layout of the format is final. It has all the features of my BBM format but uses a new header which allows for comments because the 4 bytes at address 0x0C are the pointer to the pixel data. This means literally anything could be between the header and the data. In this example a small comment of the name of the format: “Binary Pixel Map”. These screenshots show the equivalent PBM file and the checkerboard that it looks like.
The goal of this format is to be able to eventually support any type of image whether monochrome, grayscale, or full color RGB. The code needs work but if I made a good conversion tool people would see why my format is superior to several others with the exception of compression because I don’t know how that works yet, but…
View original post 7 more words
View original post 359 more words
There are so many decisions to be made when designing my own image format. I know it will be a 1 bit per pixel format much like monochrome BMP files or PBM and XBM.
However the exact details of the header have yet to be decided.
Currently my program produces Windows version 2 BMP files for the checkerboard. This format has been supported since Windows 2.0(released December 9 1987!).
14 bytes for the bitmap file header
12 bytes for the DIB header
6 bytes for the 2 colors in the palette. Each taking 3 bytes for Red, Green, and Blue.
That’s a total of 32 bytes. I love the BMP format but it has a lot of junk data in the header that is reserved or tells how many bytes are in the file.
But my biggest criticism of the format is the fact that the width of each row must be a multiple of 4. This means hundreds of extra bytes for no good reason.
PBM files only have a few extra bits at the end of the row if the image width is not a multiple of 8 but that’s only because computers operate on 8 bits at a time.
PBM was the first official format that I learned to write with only code from the C standard library. In fact a few printf and looped fputc calls on a file opened in binary writing mode is really all you need. The details of that format are here.
Both the Windows BMP and the NetPBM PBM format are perfectly capable of storing ANY image containing only black and white. They can also pack each pixel into a single bit!
But here is where they differ.
BMP files can have a color palette so that the two colors can be whichever two colors the author chooses.
PBM can be black and white only
BMP requires padding at the end of each row of pixels to be a multiple of 4 bytes.
PBM doesn’t have to have that extra padding and the files will typically be hundreds of bytes smaller.
BMP files have binary headers for the information about the bitmap and how it will be displayed.
PBM files have a plain text header that can be viewed even in Notepad! Yet they still are smaller than the space wasting headers of BMP.
I have decided currently that my format will be called:
BBM: Binary Bit Map
Sort of redundant I know but it was to emphasize that it’s a format for two colors. I reject the gender binary but not the binary numeral system! Also there will be no plain text unlike PBM has.
But the specific details of how the information will be stored has a few things that I’ll need to decide on.
Or do I use only two bytes for each which allows a maximum image of 65535*65535? That’s probably bigger than any image that websites allow uploading. A single image would be close to 4 GB!
2. Do I include a color palette like BMP has or should it be strictly black and white for tradition?
3. How will I deal with the extra unused bits when the total number of pixels is not a multiple of 8? Should I use the same routine as for pbm where the end of the row is padded to be a full byte. Or should I use an even more clever method like only padding to a full byte at the end of the entire image? I think there are advantages and disadvantages to each approach.
Also worth mentioning is the XBM format.
XBM is worth mentioning because although it is a text format and takes a lot of space, it is a monochrome format which stores 1 bit per pixel. My own format will be so much like it that converting it to an XBM would be trivial.
This is exactly how I feel about the self proclaimed animal lovers too.
Animal products, animal riding, animal racing, hunting, pet breeding, rodeos, circuses, and zoos all have one very important thing in common: The fact that they are UNNECESSARY to human existence.
They are also all directly responsible for by far the majority of needless global suffering.
The following letter is a confrontation and challenge to self-proclaimed “animal lovers” who are still selfishly paying the mentioned industries to provide products and services of needless suffering. [AKA, those who eat and wear animal products and/or participate in animal sport/entertainment sectors.]
To whom it may concern,
You DO NOT love animals.
What you MEANT to say was, “I love the company and comfort of having “pets”.
Constantly I hear and see people say this. “I love animals”, always coming from people who EAT and WEAR animals, who label themselves “animal lovers” while also participating in the massive holocaust of countless species of…
View original post 359 more words
Life news December 2018
I do not write on my blogs as much as I would like but here is a little update. I’m trying to arrange going to school at Longview and take computer science. Still on the waiting list to get my own apartment as well.
I also recently got a cell phone and am on my dance teacher’s sprint plan. It really opens up my potential for communication with my friends and so I’m really happy lately.
I’ve also been oddly emotional lately and writing some weird poetry. Whatever, life is strange.
For some time I’ve been attempting to learn a little bit of C# the programming language. It’s very much like C and C++ except that it comes with the whole .NET framework which includes a method of creating images. This makes it easier for graphics programming than C or C++ because the standard libraries don’t include such features and I have not yet learned how to use a third party library for those to do what I want. For now however I am impressed with how easy this simple experiment was to do in C#.
I read enough of the C# reference to create a bitmap, turn every pixel yellow, and save it to a PNG file. These screenshots show how it works!
Here is the link to where I was reading the methods of the Bitmap class.