Solved

Large bitmaps

Posted on 2001-09-11
11
342 Views
Last Modified: 2011-09-20
Hello!
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?

Thanx.
0
Comment
Question by:shtern
  • 5
  • 5
11 Comments
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6473801
Hello

  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
http://www.efg2.com/Lab/Graphics/VeryLargeBitmap.htm

Best regards
Mohammed Nasman
0
 

Author Comment

by:shtern
ID: 6473824
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???
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6473854
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
0
 

Author Comment

by:shtern
ID: 6473876
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.
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6473966
if you have problem in viewing try this

A Big Bitmap Viewer
http://www.undu.com/DN970101/00000013.htm

look also for similar problems

http://www.nsonic.de/Delphi/txt_WIS00255.htm
http://community.borland.com/article/0,1410,17418,00.html
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:shtern
ID: 6474001
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?
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6474024
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?
0
 

Author Comment

by:shtern
ID: 6474646
My code is simply:

bmp := TBitmap.Create;
bmp.PixelFormat := pf4bit;
bmp.Width := 20000; //the sizes are a sample
bmp.Height := 1000;
bmp.SaveToFile('1.bmp');


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.
0
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 300 total points
ID: 6476193
Hello

  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.

begin
  Bitmap := TBitmap.Create;
  Bitmap.PixelFormat := pf4bit;
  Bitmap.Width  := 20000;
  Bitmap.Height := 1000;
  Bitmap.Canvas.Rectangle(10,10,400,500);
  Bitmap.SaveToFile('e:\Bitmap.BMP');
  Bitmap.Free;
end;  

look at MS site for this problem
http://support.microsoft.com/directory/article.asp?ID=KB;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
0
 

Author Comment

by:shtern
ID: 6476313
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.
0
 
LVL 17

Expert Comment

by:geobul
ID: 9296462
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.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thanks,

geobul
EE Cleanup Volunteer
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Mydac connection data base issue 3 135
FMX enumerated colours 2 84
Process Javascript errors with Delphi TWebBrowser 1 111
Making delphi communicate with a c# service 16 86
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now