Page 1 of 1

[guide] calculate screenshot dimensions

Posted: Fri Aug 29, 2014 1:28 pm
by arl85
edit: I'm attaching a ods spreadsheet that calculates correct dimensions for you. You simply need to provide top left and bottom right corners and zoom level. you'll receive the string to use in-game.
it should work with any locale but I'm not 100% sure (in Italy we use "," as decimal separator)


Anyway, I'm trying to take a screenshot of my whole base using the takescreenshot function and I decided to share what I figured.
I took 3 pictures
position = 0,0 - resolution = 1024, 1024 -> picture 1
position = 32,0 - resolution = 1024,1024 -> picture 2
position = 16,0 - resolution = 2048,1024 -> picture 3
I can put picture 1 and picture 2 adjacent (or "stitch" them) and they'll match perfectly (*) on the borders. the result is the same of picture 3.

what I figured is that seems that every "unit" of "position" parameter at zoom 1 is equivalent to 32 pixels
so if position is expressed in tiles, and we consider that a chunk is made of 32 tiles we have that a single chunk is exactly 32*32 = 1024 pixels (each side)

note: when you pause game a grid appears: if you watch carefully you'll see that every 32 columns the border is thicker.
pressing F4 then selecting "always" tab and "show detailed info" and "show tile grid" you can see "position" value (displayed as "cursor")

Code: Select all

 |<--1024->|<--1024->|
-16   0    16   32   48
 +----+----+----+----+ -16
 |picture 1|picture 2|
 |    *    |    *    + 0
 |  (0,0)  | (32,0)  |
 +---------+---------+ 16

 
 |<-------2048------>|
-16   0    16   32   48
 +----+----+----+----+ -16
 |      picture 3    |
 |         *         + 0
 |      (16,0)       |
 +---------+---------+ 16
(*) or better, almost perfectly because they are at different stage of animation


edit:
so what it can be useful for?
As I said, I want to take screenshot of my complete base.
So I activated "detailed info" (F4 - "always" - "detailed info" or F5 - but this shows too many info for me...)

Code: Select all

I moved to TopLeft (TL) angle of my base and wrote down coordinates (TLx = 4 TLy=-16)
I moved to BottomRight (BR) angle and did the same (BRx = 240 BRy = 310)

zoomLevel (ZL) = 1
image width = W = BRx - TLx = 240 - 4 = 236
image height  = H = BRy - TLy = 310 - (-16) = 326

Image Center X = ICx = TLx + W/2 = 4 + (236/2) = 4 + 118 = 122
Image Center Y = ICy = TLy + H/2 = (-16) + (326/2) = (-16) + 163 = 147

# of pixel on X = Px =  W * ZL * 32 = 236 * 32 * 1 = 7552
# of pixel on Y = Py = H * ZL * 32 = 326 * 32 * 1 = 10432
so I called

Code: Select all

game.takescreenshot{zoom=ZL, position={ICx,ICy},resolution={x=PX,y=Py}} 
and replacing variables with real number

Code: Select all

game.takescreenshot{zoom=1, position={122,147},resolution={x=7552,y=10432}}
and got the result.

Since it was a very big file (127 MB) I scaled it by 4 (ZL = 0.25) and I called

Code: Select all

game.takescreenshot{zoom=0.25, position={122,147},resolution={x=1952,y=2608}}
Hope this helps other people!

Re: [guide] calculate screenshot dimensions

Posted: Fri Aug 29, 2014 5:15 pm
by OBAMA MCLAMA
Wow. This sure as hell beats running around your base taking screenshots and stitching them together.

How long did it take to render the 127mb picture?

Re: [guide] calculate screenshot dimensions

Posted: Sat Aug 30, 2014 7:10 am
by arl85
OBAMA MCLAMA wrote: How long did it take to render the 127mb picture?
on my pc (4core 2 GHz) no more than 3/4 seconds for generating and almost the same to display it in windows (it take same time to load such a file)

Re: [guide] calculate screenshot dimensions

Posted: Tue Apr 19, 2016 6:07 pm
by Lee_newsum
This has bin done befor "FactorioMaps"
viewtopic.php?f=86&t=5812&hilit=FactorioMaps