How big can a picture be?

Ive been running into trouble creating large pictures.
I can see there is a limit of 32767 pixels in any dimension
But even at smaller sizes I can easily get out of memory exceptions.

How big a footprint can we create as a picture with safety?

(I have MBS Plugins, and thought the Large Picture class might have been a useful replacement, but I find it has no .graphics property and can’t be used as a simple drop in replacement for a a picture you create yourself.)

What do you want to do with the picture?

AFAIK using the Xojo picture class is limited to 4GB of memory in 32-Bit, this should change once we migrate to 64-Bit.

The largest picture I ever processed with a Xojo built application (Shine) is a 21,772 x 6,804 pixel TIFF image file.

However it was processed using Apple’s Core Image APIs on a 2.7 Ghz Retina MacBook Pro with 16GB of memory.

Well, basically make a big picture and draw on it.

In theory I could need something
64000 x 64000 pixels

Imagine a tiled game where tiles are defined as 64 x 64 images.
The map could extend to 1000 x 1000

draw the whole map.

If I chop the tile size to 32sq , its under the pixel size but runs out of memory
Changing to 16bit colour doesn’t help or make a difference under Cocoa , it seems

How many different variations of the tiles could there be?

I once worked on a game (think Pokemon), where the world was huge (don’t recall exactly now, but huge). However there were only something like 32 different tile types. So these were loaded and released when needed and the entire map was a series of smaller maps that were effectively 1-Bit images.

Sorry meant to add that the whole map was never in memory all at once and the tiles were only drawn on screen (never drawn to an image).

Even though you have 16gb of ram Xojo is 32bit so in reality you only have 4GB (I believe on Mac)

The DPI doesn’t need to be great on massive images, in the 3D world we use really low sampling and anti alias

Got that covered.
What I need is the whole map in one picture

64000x64000 is much bigger than even the largest screens so drawing the whole map like this seems to be a waste of computer resources (memory etc). Is there a reason you need to draw the entire map, or would you be able to render only what is visible to the player which would be much more efficient?

Is this something where you want to zoom in and out from the full map to the full res tiles? You can use mipmaps for that, basically each tile or tile group at different resolutions.

Yes, because I want the whole thing in a picture on disc. Display and screen size is not the issue.

No. Im trying to create a big picture, not display it or a section of it on screen.

Forget the tiled game example - that was just to get the idea of size in pixels across… it seems we are homing in on solving the wrong problem
I need to create a very big picture and save it to disc.
Imagine I want a massive map of the world with photographs overlaid on major cities if you like.

Then you’re going to need to process it in chunks.
Process a chunk, write it to temporary, release the memory, process another chunk.

Jeff, do the math 64000x64000 by itself is 4,096,000,000 and that then needs to be multiplied by the bytes per pixel so it is going to far exceed current, 32bit limitations if you are going with a single picture.

[quote=167732:@Jeff Tullin]Ive been running into trouble creating large pictures.
I can see there is a limit of 32767 pixels in any dimension[/quote]

Sure. 32767 * 32767 * 4 is over 4 GB while you can only have 1 GB per image currently.

IT can be used as a replacement. e.g. you can allocate a 10 GB image and copy portions into picture objects for editing.

Why not use an array of classes? Create a class that contains properties for X (Lat), Y (Long), Z (Elev), Type, Condition, Unit occupancy (and any other important characteristic) as Uints. Save that array instead of a huge picture and then use the array to build and display your game grid.

Thanks Tim.
But it’s not really a game grid
I’m not solving a game problem.=, Im trying to make a big picture.

Correct.
So the answer about how big can a picture be is to work backwards from 4Gb (3Gb on some machines?)

Thats what I need to work out how to do. :slight_smile:

[quote=167772:@Jeff Tullin]Thanks Tim.
But it’s not really a game grid
I’m not solving a game problem.=, Im trying to make a big picture.[/quote]

[quote=167738:@Jeff Tullin]Imagine a tiled game where tiles are defined as 64 x 64 images.
The map could extend to 1000 x 1000

draw the whole map.[/quote]
Okay, but what was that about?

Regardless of the use - game or picture, my logic still applies since there’s no software that can handle displaying such a picture. Even the big mapping software used by JPL uses stored arrays of image data and only loads what the scientist / researcher is processing.

I thought it would help explain the size of the picture I wanted to create.
Obviously it went horribly wrong because everyone assumed the problem was how to display such a picture in my app.
Its not.

Never mind, everyone.
Save a smaller picture with poor detail seems to be the answer.

I appreciate the well-intentioned replies.

[quote=167774:@Jeff Tullin]I thought it would help explain the size of the picture I wanted to create.
Obviously it went horribly wrong because everyone assumed the problem was how to display such a picture in my app.
Its not.

Never mind, everyone.
Save a smaller picture with poor detail seems to be the answer.

I appreciate the well-intentioned replies.[/quote]

Why are you angry because people did not understand your intent in the first place ? Your dry description in the original post did not make much justice to the intelligence of the reader.

[quote]How big a footprint can we create as a picture with safety ?
[/quote]

You could have answered that one yourself. Create bigger and bigger images, until you bump into the limit.

[quote=167761:@Jeff Tullin]I need to create a very big picture and save it to disc.
Imagine I want a massive map of the world with photographs overlaid on major cities if you like.[/quote]

Saving pictures larger than RAM is not an issue. With disks Terabytes you could put several 64,000 square pictures on them.

As you said, smaller pictures is probably the way. They do not need to be at lower resolution, though. Just smaller than RAM enough not to choke the computer. “Poor details” seems a bit extreme…

If you want to have your big picture on disk, then you could concatenate all pictures the same way NASA does. There seem to be tools available :
https://duckduckgo.com/?q=concatenate+pictures

Now reading portions of that behemoth may be kind of challenging.

I frankly doubt Google uses one big picture for Earth…

[quote=167772:@Jeff Tullin]Thanks Tim.
But it’s not really a game grid
I’m not solving a game problem.=, Im trying to make a big picture.
[/quote]
I wasn’t talking about a game grid, I was talking about memory management.
Michel explained in the post above me with better terms what I was getting at.

We all keep explaining the same concept to you, but you’re not grasping it. If you want one big picture, you’re going to have to write it in small chunks to work with the memory limitation.