Max Pixmap Size?

BlitzMax Forums/BlitzMax Programming/Max Pixmap Size?

BLaBZ(Posted 2010) [#1]
Just wondering how big a pixmap can be?

I need to save the largest(in pixels) possible PNG image. :)

Thanks!


plash(Posted 2010) [#2]
Depends on your memory.


ImaginaryHuman(Posted 2010) [#3]
It's not the amount of memory you have it's the size of the largest contiguous block of memory. As far as the pixmaps go you can use integer sizes (signed), so like 2 billion in each dimension. The largest I've ever done personally is 4096x4096 which worked fine.


BLaBZ(Posted 2010) [#4]
Is there a way to increase the largest contiguous block of memory? Or add multiple blocks of memory?


xlsior(Posted 2010) [#5]
Is there a way to increase the largest contiguous block of memory? Or add multiple blocks of memory?


Under Windows there are some API calls that can be used to send a system-wide message to running applications to return any unused memory, which could result in larger blocks of contiguous memory... But of course there are no guarantees.


Czar Flavius(Posted 2010) [#6]
Why not split your image into smaller chunks and tile them? Pixmaps are scaled UP to the nearest power of 2, so any chunks should be of size 64x64, 128x128, 256x256 or etc to optimise memory usage.


BLaBZ(Posted 2010) [#7]
There's an idea! I'm just trying a few things...

This is the largest pixmap I can make

SuperStrict 

Local PixMap:TPixmap=CreatePixmap(18735,18735,PF_A8)


Print GCMemAlloced()

SavePixmapPNG(PixMap,"pixmap.png",9)

Print GCMemAlloced()


does this work for anybody else?


BLaBZ(Posted 2010) [#8]
If I used threading, would I be able to load images practically simultaneously while I displayed them?

Ex:Streaming video, how it plays and downloads simultaneously


Jesse(Posted 2010) [#9]

Local PixMap:TPixmap=CreatePixmap(18735,18735,PF_A8)


excuse my ignorance but why would you need a pixmap that big?
I personally can't think of a real use for it.


Gabriel(Posted 2010) [#10]
If I used threading, would I be able to load images practically simultaneously while I displayed them?

You'd have to be pretty clever about it. I don't think DX or OpenGL - in the versions that BMax uses - are threadsafe.

Perhaps it would help if you explained what you're trying to achieve. The whole huge images and streaming display questions suggest that you actually have a problem you're trying to solve. If so, people may be better equipped to help you solve it if they knew the precise nature of the problem you're attempting to solve.


ima747(Posted 2010) [#11]
Streaming an image to display through bmax via multithreading should not be possible (corret me if I'm wrong someone with more knowledge...) for a number of reasons without some custom management.

The primary reason is opengl (and dx under 11 I believe... and I think bmax only uses up to 9...) are not thread safe, meaning you can only interact with them from the main thread, so you can't stream in a child and draw in the main because you can't create or update the texture memory you want to display from the child thread.

The way I would go about hacking it would be to write a custom image handler format that loads to memory (possibly in batches so there's a time when it's safe to read between writes) and then spins whatever's loaded off into a drawable texture. Either that or just directly draws pixels but that would be sloooooooow, which kinda defeats the purpose of threading it up...

Also keep in mind that threading can have some quirks and is a pain to debug.

As Gabriel said, if you can pose a hypothetical problem perhaps a specific solution can be thought up.


ImaginaryHuman(Posted 2010) [#12]
Your image size is about 350 megs.. possible that it'll work.