So, I'm expanding my previously released map generator. I've added stuff like biomes, biome generation types, so on so on.
The thing is, I'm making this generator because I want to start an RP community with stuff like being able to claim territory.
My problem: The map is too small. 128x128 is not a high enough resolution for this map. I've modified for the map generator to work on 256x256 pixels, but that would mean I would have to take four screenshots and manually stitch them together, which is a very frustrating process.
So, my question is, is it possible to take a 256x256px screenshot?
Cheers.
EDIT: I think it's worth noting that for automatically taking screenshots in my code is done with
extcmd('screen') |
which could be a slight problem.
You can write 'screenshot_scale 2' in the config file to achieve this.
Edit: I misunderstood your request! Would a map export fix your problem? 'export game.map.png'
(that won’t include sprites, text or other shapes)
@merwok Unfortunately, no. The map generator puts pixels on screen using pset and circfill, and I'm entirely sure you can't save that to the map, especially persistently.
The only automated way I see is to use one of the serial channels (standard output or '-o filename' parameter, only for standalone pico8 program (not HTML export)), have the game draw one screen then send screen data to the channel, repeat for 4 parts of the screen, then have another script (in python or lua or anything you know) that receives the data and stitches it together.
Oh! Actually it should be possible to save a screenful of pixels to the map. Put pixels on screen like you’re doing, then copy screen memory to spritesheet memory, then you can set the map memory to be sprite 1, sprite 2, etc. up to 256 (can use mset in a loop to start simply, then find the right parameters to use with memset).
Would this help, @wallgraffiti ?
That tool seem to be the equivalent of 'export game.map.png', but the request here is for a 256x256 capture of the screen (containing arbitrary pixels).
That’s why I suggested copying screen to spritesheet, then make a map with sprites, then you can get an image of the map.
Well if that's the case, @merwok, then it does seem like my map program was a good idea after all since I wrote it 2-years ago prior to current export .map ability.
@zep always has these wonderful ideas. :)
However, @wallgraffiti, you can certainly create an array thus:
bigscrn={} for i=0,255 do bigscrn[i]={} for j=0,255 do bigscrn[i][j]=0 end end |
Then access via:
for i=0,127 do for j=0,127 do bigscrn[j+128][i]=sget(j,i) end end |
That would save your current 128x128 sprite set to the top-right of your 256x256 pixel array.
If you want to copy the actual screen screen, change SGET() to PGET() thus:
for i=0,127 do for j=0,127 do bigscrn[j+128][i]=pget(j,i) end end |
And once again this copies your 128x128 screen to the top-right-hand corner of your 256x256 array.
Yes, I wasn’t saying your program was not useful (before pico8 added the feature), but that it wasn’t answering the original request :)
Code for a 2D table can be useful, but something more is needed to go from table to picture!
Well ... How about this ? I could write two programs. One in Pico-8 to take the raw data from the 256x256 array and copy it to clipboard.
Then write a 2nd program that takes the Pico-8 clipboard data and saves a proper PNG or JPG that is 256x256 pixels from the clipboard data.
That would be one way!
The technique I suggested would work with pico8 only. But it needs to be written in full ;)
@wallgraffiti, you write the code you need that will fill up the arrays with pixels. Here, go and use this to start if you like:
function _init() hex="0123456789abcdef" scrn={} for i=0,255 do scrn[i]={} for j=0,255 do scrn[i][j]=0 end end -- here have your code fill up the -- 256x256 pixel array using single -- values of 0-15 per pixel. end |
Post your p8.png app in a reply where you have scrn[][] filled with the pixels you want.
Then I'll take your code, finish it for you where it will output a true single 256x256 pixeled .PNG image saved.
[Please log in to post a comment]