Re: Saving a large TJpeg - Insufficient Resources?



Nicholas Sherlock wrote:

Roy wrote:

I'm loading the file into a TJpegImage, creating a Tbitmap and using stretchdraw to copy the data to the bitmap - then using the bitmap.canvas to write my text, then finally using jpeg.assign to get back into jpeg format before using jpg.savetofile

but... with the larger images (3000x2000 pixels) I'm getting an exception telling me there are insufficient resources. If it can load the jpeg to start with, how can this be??


IIRC, on Windows you're only guaranteed to be able to create a Windows bitmap that's the same size as the screen, no larger. The bitmap you have there is very large! I'd investigate TBitmap32, from Graphics32, which either doesn't use Windows to create the bitmap, or can be patched so that it doesn't (I can't remember which).

Cheers,
Nicholas Sherlock
changing it to a DIB instead of the default DDB will solve that issue.
even with printer output..
as soon as you set the pixel format, it's converted.
mybitmap.pixelformat := pf32bit; for example.
how ever, I've found that many print drivers do not handle
32 bit DIB's for some reason. so for printing, I stick to 24 bit.


--
"I'm never wrong, once i thought i was, but was mistaken"
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5

.



Relevant Pages

  • Re: efficient way to find and unused color in an image.
    ... Miles Bader wrote: ... If it is, restart from ... recording which colors are used in a bitmap, and then scan the bitmap in ... Nicholas Sherlock ...
    (comp.graphics.algorithms)
  • Re: Transparent Blit with NT4
    ... > Mike D Sutton wrote: ... > Pretty sure I'm not - I have tested it on Windows ME, works fine, and ... >> Also, how are you creating the bitmap you're drawing from, and what ... > REM and direct drawing for the rest ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Bitmaps anzeigen?
    ... The SetDIBitsToDevice function sets the pixels in the specified ... Windows 98/Me, Windows 2000/XP: ... // array of DIB bits ... CONST BITMAPINFO *lpbmi, // bitmap information ...
    (microsoft.public.de.vc)
  • Re: Saving and loading bmp using graphics object
    ... Windows needs to know that part of your window needs redrawing. ... that this bitmap is a copy of what you want to appear on screen. ... > private void DrawPoint ... > private void Scribbler_MouseMove(object sender,> System.Windows.Forms.MouseEventArgs e) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Fast drawing of graphs
    ... Actually, if you use MFC, it is equally trivial to draw on a background bitmap; ... used full-screen displays with splitter windows and never resized the windows, ... >I programmed a class that draws an x-y graph on a CStatic window. ... >achieved by not drawing directly on the, but drawing to a hidden bitmap ...
    (microsoft.public.vc.mfc)