6

If you open up your favorite drawing package and start a new image, you'll likely be asked to input the dimensions of the frame (width and height). For example, Pinta shows this:

Pinta "New Image"

However, I recently noticed the MyPaint has infinite canvas size by default. It seems like using an infinite canvas would be advantageous in that the boundaries won't interfere as much with your drawing. Thus, I'm wondering why frames are so commonly used in image software, instead of MyPaint-style infinite frames.

Question: Why does image software typically use frames (x pixels by y pixels) instead of an infinite canvas?

11
  • @user287001 - MyPaint is quite unique software here. The image size grows automatically as you paint. It's not actually infinite. It's analogous to changing the canvas size manually Photoshop.
    – Billy Kerr
    Aug 21, 2022 at 10:21
  • Never used MyPaint (and I can't seem to install it on my system), but how do they deal with tools like flood-fill (a.k.a Paint-Bucket)?
    – Kaiido
    Aug 22, 2022 at 7:59
  • 2
    my paint is not even slightly infinite. it just allocates a 1000x1000 square, and, if you paint "towards the edge" it very simply adds another one of those. Indeed, very simply, if you do that (say) 30 or 40 times, mypaint simply stops and says "you've made the cavnas too big".
    – Fattie
    Aug 22, 2022 at 11:36
  • 1
    note that vector drawing is conceptually completely "infinite". simply, you can specify that a point is at any place whatsoever.
    – Fattie
    Aug 22, 2022 at 11:43
  • note that indeed, I'm sure there was once a plug in someone made for photoshop, that, simply, when you got near one edge just automatically changed the size of the canvas, so, you didn't have to bother doing that.
    – Fattie
    Aug 22, 2022 at 11:44

4 Answers 4

6

Having an infinite canvas makes the memory model more complicated and slower. See, the computer needs to access the memory locations. The most efficient way to do this is to just allocate one continuous block of memory.

A continuous block is easy to work with and fast to operate on. The speed boost is nothing to sneeze on as a processor guesses what the next operation should be, if it's not, it will discard a lot of work. Likewise, copying continuous blocks to the graphics card is faster.

Anyway, this is probably not such a big problem when you work with screen-size items. You can just reserve a big block and be done with it. Alternatively, store tiles or something. But this can become a big problem with print-size media as it's easy to just push the canvas beyond your computer memory bounds. After which everything becomes like wading in a treacle.

Anyway, this design choice is probably also a legacy reason. Most of the software weren't designed for the machines that you would buy now. In a time when your computer had mere 4 gigabytes of free memory after the OS took its share, the situation looks a bit different than a machine where you have 30-200 GB of memory free. It's way easier to rebuild memory if you have a lot of free continuous memory to work with.

But in any case, you can just make the canvas so big that it's not an issue.

11
  • the canvas size in MyPaint isn't actually infinite. It just grows automatically as you paint, which makes it look/feel as if it's infinite from the user's perspective. It's native file format is .ora
    – Billy Kerr
    Aug 21, 2022 at 10:30
  • @BillyKerr i understand that. Bit growing a continious memory block is a heavy operation
    – joojaa
    Aug 21, 2022 at 10:36
  • 1
    This answer really just adds confusion, by throwing in a mix of "computer sounding terms" that are used meaninglessly, I'm afraid.
    – Fattie
    Aug 22, 2022 at 11:38
  • 1
    @joojaa I think you lost him at "memory"... :-)
    – Mentalist
    Aug 22, 2022 at 13:50
  • 1
    mere 4 gigabytes of free memory after the OS took its share - this model (setting the size upfront) is unchanged since it was a few mega bytes spare - Paint Shop Pro on Win95 with 32MB RAM in my case. MS Paint did the same on Win3.1
    – Chris H
    Aug 22, 2022 at 15:36
6

"Mama, why does image processing software have fixed-sized pictures?"

The spiritual answer: "Because the universe is finite."

The autopoietic answer: "Because all common image file formats read by the programs have finite sizes." "But mama, why do the file formats have fixed sizes?" "Because the programs write them that way."

The software developer answer: "Because the level of complexity would have overwhelmed most developers, tools and machines 35 years ago."

The historical answer: "Because it's been that way forever, we are locked in with a huge user base that would complain about any drastic conceptual change, and the old file formats we deal with don't support it anyway."

The cost/benefit answer: "Because it is still much simpler, even today."

The skeuomorphic answer: "Because the mental model at the time of inception was that of a physical rectangular picture on a canvas."

The utilitarian answer: "Because it fits the use cases. Do you even know where the "Enlarge Canvas" menu entry is?"

The pragmatic answer: "Because the world is imperfect."

The user interface answer: "The model is not only simple to implement, it is also intelligible to any 4 year old and my grandpa."

The border condition answer: "Because the first machines that came with image processing had less than a MB of memory (which ought to be enough for everybody), so the data structures, the code and the files had to be quite small. Continue reading under 'historical answer'".

1
  • 2
    Professional answer: Because the delivery documents says image needs to be x by y pixels.
    – joojaa
    Aug 22, 2022 at 9:01
3

Question: Why does image software typically use frames (x pixels by y pixels) instead of an infinite canvas?

A frame is much simpler to implement, its performance is known and computer hardware namely graphics cards have evolved to handle frames very quickly.

Probably more 'why' than you want

MyPaint gives the illusion of an infinite canvas with what it calls a tiled surface. https://github.com/mypaint/mypaint/blob/master/lib/tiledsurface.py

Imagine a tiled wall. Now imagine painting on this tiled wall. Painting on a tiled surface is similar. Each tile is just like a frame with a set number of pixels e.g. 256 pixels high by 256 pixels wide. MyPaint divides the infinite canvas into an infinite number of tiles, but it doesn't need a frame for each tile because they are all blank at first. The first time you paint on a tile MyPaint requests a frame from the computer's memory to store your painting.

So MyPaint arranges all the tiles on the screen to make it look like one continuous canvas when really its a bunch of much smaller frames.

The more specific answer

It's much easier to handle one large frame in code than to handle a bunch of smaller frame tiles.

2

It's because raster images have a fixed width and height in pixels. Although we often refer to it as a "canvas" - it's not really a canvas as such. It's the actual size of the image measured in pixels.

Software such as Photoshop/GIMP/Krita etc, use "image size" and "canvas size" as different concepts. You can change the image size to enlarge or reduce the number of pixels in an image (called resampling), or change the canvas size to increase the number of available pixels to paint on, without actually enlarging or resampling the image.

MyPaint is a bit unique in this respect, and is unlike most other raster painting applications. As you paint, the image (or canvas) grows in size automatically which makes it feel like it's infinite. However, there's nothing magical going on here. The canvas is not really infinite. When you save/export your finished drawing/painting, it will still have a finite size in pixels.

3
  • In Photoshop, can't you move objects outside of the canvas, and they're still "somewhere", even if they aren't rendered in the finite canvas, or are lost if the layers are flattened? Aug 21, 2022 at 16:26
  • Yes I know, but they won't be visible if you then export in a format such as jpeg or png, anything outside the canvas will be removed.
    – Billy Kerr
    Aug 21, 2022 at 17:45
  • 1
    After exporting the image to a common graphics/image file format like jpeg or gif the format requires a finite and definite image size; this circumstance is unrelated to the inner workings of any software. Aug 22, 2022 at 4:07

Your Answer

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

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