CreateImage() Limit?

Just starting out? Need help? Post your questions and find answers here.
arma
User
User
Posts: 61
Joined: Sun Jul 24, 2016 11:54 pm

CreateImage() Limit?

Post by arma »

Hello everybody,

Is there any way to create larger than 32000px height Image... I need to create 150000-200000 pixel height photos...
Any tricks to do this?

Thaks!
User avatar
Demivec
Addict
Addict
Posts: 4091
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: CreateImage() Limit?

Post by Demivec »

arma wrote:Is there any way to create larger than 32000px height Image... I need to create 150000-200000 pixel height photos
A picture that size in 32 bits per pixel would require over a Terabyte of memory :!:

Perhaps there may be some useful information in these links regarding this common problem:

http://www.purebasic.fr/english/viewtop ... 13&t=66710
http://www.purebasic.fr/english/viewtop ... 13&t=66050
http://www.purebasic.fr/english/viewtop ... 13&t=58655
http://www.purebasic.fr/english/viewtop ... 13&t=57438
http://www.purebasic.fr/english/viewtop ... 12&t=56288
arma
User
User
Posts: 61
Joined: Sun Jul 24, 2016 11:54 pm

Re: CreateImage() Limit?

Post by arma »

No no you did missunderstand me, I need 150000-200000pixel in one direction,
for example 1024x200000. or 200000x800, etc.
Then it costs memory around 1GB of RAM. Also I dont have memory problem,
I have 128GB RAM. But i need to create that kind of resulation photos... If possible.
If NOT, i find external solutions. But that solutions makes my program runs slower :(
User avatar
Lord
Addict
Addict
Posts: 849
Joined: Tue May 26, 2009 2:11 pm

Re: CreateImage() Limit?

Post by Lord »

You can create an image at large scale as long as it fit in less than 2 GB.

Just disable debugger around canvas or image creation:

Code: Select all

#maxH=100000; Change size here

Procedure DrawSomething()
  StartDrawing(CanvasOutput(2))
    LineXY(0, 0, 800, #maxH, #Red)
  StopDrawing()
EndProcedure
Procedure ClrSomething()
    StartDrawing(CanvasOutput(2))
    Box(0, 0, 800, #maxH, #White)
  StopDrawing()

EndProcedure


OpenWindow(1, 10, 10, 1024, 758, "")
DisableDebugger
hScrollArea=ScrollAreaGadget(1, 0, 0, 824, WindowHeight(1), 800, #maxH)
hCanvas=CanvasGadget(2, 0, 0, 800, #maxH)
CloseGadgetList()
EnableDebugger
Debug hCanvas
Debug hScrollArea
If hCanvas
  ButtonGadget(3, 900, 10, 48, 24, "Draw")
  ButtonGadget(4, 900, 50, 48, 24, "Clear")
  BindGadgetEvent(3, @DrawSomething())
  BindGadgetEvent(4, @ClrSomething())
EndIf
Repeat
  Event=WaitWindowEvent()
Until Event=#PB_Event_CloseWindow
The limiting factor here is the CanvasGadget.
It can't be larger than 32768 in either direction.

Be carefull at the upper end of canvas/image size.
The handle starts to be unreliable as indicator for a successful created canvas/image when it approches the maximum usable memory.
Image
Post Reply