32K Image limit, canvas and DPI aware ?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

32K Image limit, canvas and DPI aware ?

Post by Saki »

Hello, everyone.
I have a question once.
I create in a ScrollAreaGadget
a canvas in the size 32000*16000 to display and edit a satellite photo.
I continue to create an image of this size and equivalent buffers.
The software should also run under Windows and be DPI aware, because without DPI aware it does not look good with the fonts.
A user of the software now has a 4K monitor
It sets a scaling of 225%, which is common
Since the images adapt to the canvas, the PB 32000 Limit
for images exceeded by 125%
In the near future we can expect to see photo sensors that exceed this limit.
The 32K limit will no longer allow to handle very large images in the future.
Loading and saving such large images is only possible with JPG
acceptably fast, which is another problem.

What you think about ?
地球上の平和
Bitblazer
Enthusiast
Enthusiast
Posts: 736
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: 32K Image limit, canvas and DPI aware ?

Post by Bitblazer »

Implement your own virtual canvas by using scrollbars for vertical and horizonal position, a canvas and an image which covers exactly the visible size on the screen. Let the user use the scrollbars and a magnification button to scroll. That way you can display pictures of pretty much unlimite size. Since this is a problem that keeps coming up, maybe somebody writes a module for the lazy rest of us (hi Thorsten, hi Danilo ;)
Personally i would definately add a magification option (50%, 100%, 200%, 400%) but that depends on the data and use case.

Oh and a overview map with a red rectangle that you can drag over a mini version of the picture like many games use to display large maps, that is always cool.
User avatar
Danilo
Addict
Addict
Posts: 3037
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: 32K Image limit, canvas and DPI aware ?

Post by Danilo »

You should write a tile system, so you don‘t need to use 1 big image of 64.000 x 64.000 pixels in the future.

If the 64k x 64k image is in one big file, you also need to write an image loader that does not load the whole file into memory. Instead it loads only tiles into memory.

If you see only 4.000 x 2.000 pixels on the screen, you don‘t need to create a canvas or scrollarea of 32k or 64k.
You use scrollbars for a virtual scroll area and display only the part that is currently relevant.
Hidden sections don‘t always need to be in memory.

It is like 3D computer games. You don‘t just display the whole world all at once. :)
You display only the area that can be seen from current position.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: 32K Bildlimit, Leinwand und DPI bewusst ?

Post by Saki »

Hello, thanks dear friends
Yeah, it's not as easy as I thought
A lot of work
地球上の平和
Post Reply