Sunday 27 March 2016

Raspberry Pi - Take screenshots of Minecraft

If you going to take a screenshot of Minecraft: Pi edition (or anything else for that matter), I really like a command line utility called raspi2png, its simple and screenshots images which have been created using the GPU (like games) as well.


Download
Open a terminal and clone the repository from github:
cd ~
git clone https://github.com/AndrewFromMelbourne/raspi2png

Use
Change directory to raspi2png and run the program's help to show all the options:
cd ~/raspi2png
./raspi2png --help
Usage: raspi2png [--pngname name] [--width ] [--height ] [--compression ] 
[--delay ] [--display ] [--stdout] [--help]

    --pngname,-p - name of png file to create (default is snapshot.png)
    --height,-h - image height (default is screen height)
    --width,-w - image width (default is screen width)
    --compression,-c - PNG compression level (0 - 9)
    --delay,-d - delay in seconds (default 0)
    --display,-D - Raspberry Pi display number (default 0)
    --stdout,-s - write file to stdout
    --help,-H - print this usage information

To take screenshot you have to use the -p option and pass an image filename:
./raspi2png -p myscreenshot.png
Another really useful option is -d to delay when to take the picture, this enables you to get the screen ready for a shot - to take a picture delayed by 10 seconds:
./raspi2png -p mydelayedshot.png -d 10
The image files will be created in the ~/raspi2png directory - if you want them in a different directory use a full path:
./raspi2png -p /home/pi/mydir/myscreenshot.png
If you use a filename which already exists raspi2png will overwrite the file without warning and the old image will be lost.

Fyi - I wrote this blog post using a Raspberry Pi 3...  First time I've used a Pi to write about a Pi - thats progress!

6 comments:

  1. That is pretty cool. And the only reason I know what minecraft is, is because I had to get my young grandson some sort of minecraft sword for Christmas. BlockLauncher

    ReplyDelete
  2. Looking for a way to make an export of blocks 3d obj or stl ? do you have some ideas? thank you !

    ReplyDelete
  3. hi martin, im a high school student and we are using a raspberry pi v01.1 we have to create a game in minecraft using a code but i didnt get enough knowledge from my teacher. I dont know how to start. can you help me?? please thanks

    ReplyDelete
  4. Thank for the code ! I used it with Raspbin Jessie but am hav trouble with it in Stretch .
    $ ~/raspi2png/raspi2png - start1.png
    raspi2png: unable to open display 0

    Your Minecraft-Pi stuff is epic!

    ReplyDelete
    Replies
    1. I dont know what to suggest... I tried earlier on stretch and didnt have a problem. Are you using an add-on screen or anything?

      Perhaps try stating a different screen no using:

      raspi2png --display 1

      Delete

Note: only a member of this blog may post a comment.