3
$\begingroup$

It seems that every image format (jpeg, png, tiff, bmp, jp2000...) doesn't place their origin at the same corner.

Do you know where I could find some info about this differences?

I can only say that PNG and JPEG are different.

$\endgroup$
5
  • 2
    $\begingroup$ Are you asking "why is pixel 0,0 at the top left of some formats and bottom left of others?" If so, the short answer is probably that a) some formats simply mimic the way raster scanning for displays (particularly CRTs) is performed - the HW reads teh pixel data in memory in increasing address order and sends to the display from top row to bottom row, and left to right within each row. For b) I suspect some formats wanted to mimic how humans draw graphs, with (0,0) at the bottom left and the Y-axis going up the screen. $\endgroup$
    – Simon F
    Commented Oct 24, 2018 at 8:40
  • 1
    $\begingroup$ It is exactly what I wanted to ask... I take your proposal of title. jpg seems to be the only one different from other formats (tiff, png, jp2000, bmp...). $\endgroup$
    – Sandburg
    Commented Oct 24, 2018 at 10:23
  • $\begingroup$ According to en.wikipedia.org/wiki/BMP_file_format#Pixel_array_(bitmap_data) BMPs are also bottom to top. $\endgroup$
    – Simon F
    Commented Oct 24, 2018 at 13:52
  • $\begingroup$ There has to be some standard for this. I don't know why I personally feel top left to be (0,0) and bottom right as (200,200). Perhaps, due to Khan Academy's usage of processing.js $\endgroup$ Commented Oct 24, 2018 at 17:00
  • $\begingroup$ MIT Scratch has a similar co-ordinate system. So, my guess is that format developers worked in different graphic environments that influenced their decision on where to place origin. I feel left corner positions appropriate because it helps people stick to positive numbers and also LTR progression (ie, 0<1<2<3). Negative numbers take one more bit to store sometimes, or you have do some weird number inversion (ie, compliment). All in all, LOGO taught kids to move from center to different directions, assuming each new position as starting point, I feel that's where a lot of people got intuition. $\endgroup$ Commented Oct 24, 2018 at 17:05

1 Answer 1

4
$\begingroup$

It comes down to history. The original interfaces for drawing stuff on the screen were for text, not images. Since the people who designed those early computers spoke languages that are read left-to-right, top-to-bottom, it made sense for the first glyph to be the top-left one. This also works conveniently with how the image was transmitted to the display. TV signals also start in the top-left, so those CRT displays also started displaying a frame with the top-left pixel. When computers added "graphics modes" to their "text modes", it made sense for the origin to stay in the same place.

This all changed with packages specifically designed for mathematical and scientific computing. Charts are usually drawn with (0,0) at the bottom-left, so scientists wanted their co-ordinate system to work that way.

This is why we have two common options. Generally for an image format, it depends on the use-case the format was originally designed to satisfy, and what kind of people worked on it. Image formats are usually designed by engineers with experience of low-level graphics implementation, so top-down is more popular, but some formats support both for flexibility.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.