Lossless screen-recording software
FFmpeg with a lossless codec is one solution. I recall a comparison of different codecs which concluded that Apple Animation (known to ffmpeg as qtrle) gave the best quality for screen-recording.

ffmpeg -f x11grab -r 25 -s 1024x768 -i :0.0 -c:v qtrle output.mov


Stop it by opening its terminal while it is running and pressing q. Obviously change the resolution (1024x768 here) to match your own. For selecting a section of your screen, see how to grab the screen on the ffmpeg wiki.

It is possible that the ffmpeg which comes with your Linux distribution does not have the qtrle codec included. In this case you have to download and compile your own version.