Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Scaling of Bitmap Saved to Image File

Author
Message
TeeJay
18
Years of Service
User Offline
Joined: 30th Dec 2007
Location:
Posted: 1st Jan 2011 20:28
When I try to save a bitmap to an image file, it works OK if both dimensions are less than 4096 pixels. But if a dimension of the bitmap is greater than 4096 then the bitmap is scaled in that direction to equal 4096.

Here is an example



The reason I am interested in this is that I would like to produce high resolution images to display as posters.

For example, snapmad.com advises that (http://snapmad.com/about.php) a print of size 45 x 30 inches is OK at 6750 x 4500 but looks better at 13500 x 9000.

(Perhaps though this only applies to camera images where pixels are not entirely independent.)

Is there any way I can create images larger than 4096 x 4096?
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 1st Jan 2011 20:51
Maybe take a look at the Image Kit by Sven B.

If it won't do what you want Sven might have some pointers...

http://forum.thegamecreators.com/?m=forum_view&t=177340&b=5

Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 1st Jan 2011 21:22
Hi TeeJay,

Unfortunately Image Kit does not include saving/loading images from a file. It only accesses DBP images internally. Image Kit might help diving your images into several smaller parts, but it probably won't help you to write one big bitmap file.

One side note: if you load an image without the extra flag, DBP will round an image to the nearest power of 2. So make sure you use load image url$, img, 1

I would suggest to write the whole bitmap file using the read/write file commands, instead of the usual save image. I'm sure you'll find information on how to write a bitmap file on this forum or using Google.
I'm not sure about DBP and large files though (a 13500x9000 bitmap file is ~0.5GB in size). But I think the file commands are your best bet if save image doesn't do the trick for you.

Cheers!
Sven B

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 1st Jan 2011 21:55
Hi you all. Happy new year !!

Here I´v got an image 211 * 191 pixel, and I have scaled to 5940*5940, but the resotution is the same...any way, I can save it to file. Download the example image and code.






Cheers.

I'm not a grumpy grandpa
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 1st Jan 2011 22:25
Doesn't this depend on your machine/GFX card?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Jan 2011 00:41
Most likely. DBPro images are a wrapper around DirectX textures, so have the same limitations - 4096x4096 seems like one of those limits (remember the old 256x256 days anyone? )

Anyway, you can get the limits using DBPro functions:


The card in my new laptop (GeForce GT 420M 1GB) allows 8192x8192

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Jan 2011 00:46
Quote: "The card in my new laptop (GeForce GT 420M 1GB) allows 8192x8192 "



Same here.
GeForce 9300M 256MB = 8192 x 8192

I'm not a grumpy grandpa
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Jan 2011 00:47 Edited at: 2nd Jan 2011 00:50
Sorry double post...I made a mess myself.

I'm not a grumpy grandpa
TeeJay
18
Years of Service
User Offline
Joined: 30th Dec 2007
Location:
Posted: 2nd Jan 2011 15:41
Thanks for the responses. The code snippet from IanM shows that my system is only capable of 4096 x 4096. Looks like I need to buy a graphics card. I was thinking of buying one anyhow to get automatic anti anti aliasing rather than program it myself.

Does anyone have any thoughts on whether a print of size 45 x 30 inches really needs a pixel resolution of 13500 x 9000 (as specified by snapmad.com)? I suspect that 'camera pixels' have a lot less fidelity than 'bitmap pixels' so this may be an over-specification for my purposes.
bitJericho
23
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 2nd Jan 2011 17:10
Quote: "Thanks for the responses. The code snippet from IanM shows that my system is only capable of 4096 x 4096. Looks like I need to buy a graphics card. I was thinking of buying one anyhow to get automatic anti anti aliasing rather than program it myself. "


Well, it doesn't really work that way. If I recall, forcing AA on doesn't work in DBP, I might be mistaken though.

Quote: "Does anyone have any thoughts on whether a print of size 45 x 30 inches really needs a pixel resolution of 13500 x 9000 "


It depends on the printer's pixel per inch. If it's only 72, you're looking at a max width of 45in * 72ppi = 3240. If it's higher, you'll have to adjust accordingly. If you can't create an image higher than 4096x4096, you're best bet is to write out the bitmap file manually like what was suggested.

You might rather want to check out blender (a 3d modeller), which is made to do what you're asking.

[center]
Join the TGC Group!
http://tehcodez.groups.live.com
Dr Tank
17
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 2nd Jan 2011 17:19 Edited at: 2nd Jan 2011 17:22
The texture size limit is interesting! I learned something new today.

You can render a series of images and then stick them together afterwards. You may find the following useful:

Login to post a reply

Server time is: 2026-07-18 07:33:09
Your offset time is: 2026-07-18 07:33:09