Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

Large bitmaps

Does anybody know why, if I create a large 16-color bitmap (e.g. 20000x1000), the half of it is white and the another half is black? Is there any limit on the size or problem with range?

  • 5
  • 5
1 Solution
Mohammed NasmanSoftware DeveloperCommented:

  Yes, there's limit on creating Bitmap in windows, it's not big in delphi, but in windows, look at this link to know how to create large bitmap with delphi

Experiment in Creating Very Large Bitmaps in Windows

Best regards
Mohammed Nasman
shternAuthor Commented:
Ok, I've had a look at it . But it is only explained why it doesn't work. I need to get it working! I don't need to load any bitmaps or anything like that. I have to create a bitmap in the memory in dependence of many values at runtime and then save it or give itto another module. How can I do that???
Mohammed NasmanSoftware DeveloperCommented:
there's a sample in that side with the code, I test it to create image 10000 * 10000

also there's the code to how create the large bitmap, not only exlpaining the problem
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

shternAuthor Commented:
Which code do you mean? You see, they all speak about the problem of OutOfResources. I don't become something like that. The bitmap is created and saved OK. But after some punkt (e.g. (6000,0), it seems to depend on the size) I can not draw on it any more. It is black and there's nothing I can do about it. But creating is no problem.
Mohammed NasmanSoftware DeveloperCommented:
if you have problem in viewing try this

A Big Bitmap Viewer

look also for similar problems,1410,17418,00.html
shternAuthor Commented:
This is not the problem in viewing. If I do not view it but save it to disk and view it with any graphic program I see the same: the bitmap size is righ, but some part of it on the right is black. It is created so. Why?
Mohammed NasmanSoftware DeveloperCommented:
did you try to reduce the size and then the image created successfully without the problem you got?
if your code working well in the small image, try the first link, and create the image in that way, as I told you before, there's limit on the image in windows in the normal way, (I think it's 4000 & 4000)

could you post ur code to create the image?
shternAuthor Commented:
My code is simply:

bmp := TBitmap.Create;
bmp.PixelFormat := pf4bit;
bmp.Width := 20000; //the sizes are a sample
bmp.Height := 1000;

Surely I could rewrite my code to create a number of smaller images. But what should be drawn on this bitmap is really complex, and I wouldn't like to go that way. Is there no possibility to work not with tBitmap, but with more low-level things (HBITMAP? smh. like that?). I don't really need it to be a bitmap, just something, on which I can draw.

I increase the points on 300.
Mohammed NasmanSoftware DeveloperCommented:

  I test this code in windows Me, and I got the problem you tell me about, and I tested it today in Win2k, and it's working fine, so the problem is from windows 9x/me, cuz i got the black in half the pic.

  Bitmap := TBitmap.Create;
  Bitmap.PixelFormat := pf4bit;
  Bitmap.Width  := 20000;
  Bitmap.Height := 1000;

look at MS site for this problem;EN-US;Q227617

I have idea, maybe not perfect but try it, try to separate ur image to two, and draw each one so that's will give you smaller two images without the problem, then when you want to show them, show them together
shternAuthor Commented:
Yes, maybe this is the solution. But it means for me to change really a lot of code and I'm not happy about it. If you have some other idea, let me know please.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

accept mnasman's comment as answer

Please leave any comments here within the next seven days.



EE Cleanup Volunteer
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now