Game Development Community

Saving JPEG With size 8192 x 8192... doesn't work

by Vincent BILLET · in Torque Game Engine · 08/26/2005 (4:37 am) · 2 replies

I Tried this in my TSE Engine :
int img_size = 8192;
   GBitmap tmp(img_size, img_size, false, GFXFormatA8);

   // Copy everything into the buffer.
   ColorI foo;
   for(S32 i=0; i<img_size; i++)
   {
      for(S32 j=0; j<img_size; j++)
      {
		 double x = (double(i)/256.0);//+10.0;
		 double y = (double(j)/256.0);//+10.0;
		 int aa= int(value(x,y,0.0)*160.0)+80;
		 if (aa>255) {Con::printf(".");}
		 if (aa<0) {Con::printf("- %ld",aa);}
         foo.red = aa;
         foo.green = aa;
         foo.blue = aa;
		 foo.alpha = aa;
         tmp.setColor(i, j, foo);
      }
   }

   FileStream fs;

   if(!ResourceManager->openFileForWrite(fs, filename, File::Write))
   {
      Con::errorf("SaveJpeg - failed to open output file!");
      return false;
   }
   Con::printf("Saving Picture...");
   tmp.writeJPEG(fs);
   fs.close();
   Con::printf("Done.");
   return true;
After minutes file is saved. I see Done in my console. But... FileSize = 0!!!
Any solutions?

#1
08/26/2005 (5:04 am)
Found the solution !

in bitmapJpeg.cpp
#define MAX_HEIGHT 4096

Need to replace with :
#define MAX_HEIGHT 65536
#2
08/26/2005 (4:16 pm)
That'll do it! We have it a little lower because it saves us a bit of memory.