Does anyone know what is the maximum width and height of a Bitmap in a FireMonkey TImageViewer? I am drawing vector graphics in a TImageViewer. I am only able to zoom up to a certain value then I get a memory exceprion.
Asked
Active
Viewed 1,551 times
2
-
1What is that "certain value" that causes the exception? What is the exception (the **exact** exception message you get)? It's pretty hard to answer a question that asks "How do I fix an unspecified exception that happens when I exceed a value I don't give you when zooming in a TImageViewer?" Can you [edit] your question and provide more specifics? Thanks. – Ken White Jun 15 '13 at 04:35
-
There's no limit to the size of the bitmap image, please create a simple example on how to reproduce your issue. – Peter Jun 16 '13 at 10:15
-
@PeterVonča I also noticed that limit. If you try to load large image (eg: 8000 X 5000 px) into TImage or TBitmap you get memory exception. – AvgustinTomsic Jul 02 '13 at 09:29
-
I am an not quite sure what that "certain value" is. That is what I am trying to figure out. As stated by Peter Vonča, when the image is to large there is a memory exception. If I can figure what the maximum size for the image is, I can build in checks so that the image will not exceed the maximum value. – Christo Jul 02 '13 at 14:58
-
@slotomo, when this question was posted I tested it on my machine and it works fine regardless of the size. Tested it again just now 8000x5000 px jpeg & bmp image loaded in TImage or TBitmap works just fine for me. This is why I said that he should post a simple example on how to reproduce because I simply cannot trigger that exception. Tested on both XE3&XE4. – Peter Jul 02 '13 at 15:53
-
@PeterVonča I had prepared small test project in XE3, where you can simulate this problem. [Link](https://dl.dropboxusercontent.com/u/24539514/LargeImageLoadProblem.zip) There is a zip file with two images. If you try to load the large file, then you get the exception. – AvgustinTomsic Jul 03 '13 at 05:47
-
This is a simple example that gives me a memory error : procedure TForm8.Button1Click(Sender: TObject); begin ImageViewer1.Bitmap := TBitmap.Create(9000,8000); end; – Christo Jul 03 '13 at 05:50
-
@slotomo, I get the exception now, the only reason I didn't get it before because given your previous mentioned size (8000x5000 px) works fine for me, but in the project the 8800x5600 triggers exception so indeed there seems to be a limit. – Peter Jul 03 '13 at 06:07
-
@PeterVonča I wrote these numbers (8000x5000) from my memory. I just wanted to confirm to user1980303 that that kind of limit really exist, because I also noticed this kind of problem some time ago. – AvgustinTomsic Jul 03 '13 at 06:14
1 Answers
2
I've tested this on two seperate computers and it would appear that the actual size limit to a Bitmap in Firemonkey is 8000x8000 px meaning both Width and Height respectively cap at 8000 px size.
This is what I observed, if anyone gets a different result please let me know.
How you plan to get around that is up to you, I would suggest dissecting the source image into multiple parts so that neither part excedes the limit and then assign each part to a different Bitmap component(such as TImageViewer) and then make it all come together as a whole.

Peter
- 2,977
- 1
- 17
- 29
-
Thanks. I will just test to confirm before marking it as an answer. Just one question: does this means that the width and height are limited 8000 each respectively, or is the total limit of the pixels 8000 x 8000, hence can I therefore set the bitmap to 9000 x 7000 px? ps..Is it possible to change my account from user1980303? :( – Christo Jul 03 '13 at 13:46
-
@user1980303, the width and the height are limited to 8000 px each respectively, once either of them go over the limit it will throw an exception. – Peter Jul 03 '13 at 13:48
-
Actually the limits are 8192 pixels x 8192 pixels if you use Direct 10/Direct2D (Delphi use Direct 10, in Direct 11 you can create up to 16384 pixels x 16384 pixels bitmaps). If you add GlobalUseDX10 := False; and GlobalUseDirect2D := False; to your project you can create bigger bitmaps (I believe up to 32767 pixels x 32767 pixels). – pani Nov 27 '13 at 17:10