Automatic screenshots for shell tutorial - bash

I'm working on a small bash tutorial for a programming course. I would like to alternate between explanations for the commands and images as below
Lorem ipsum dolor sit amet..
Lorem ipsum dolor sit amet...
I would like to automatically generate these images given a list of commands as doing it manually would be very tedious. Going from a screenshot to a cropped image is the easy part, I'm looking for solutions for the "commands => screenshots" part.
For example, these two images could be generated from the following "instructions" :
clear
ls
saveas "img1.png"
clear
mkdir example
ls
saveas "img2.png"
I've looked at http://ascii.io/docs/about and I was thinking of using a similar technique : a python script would be reading the "instructions" and feed them to a subprocessed shell and would be calling a screenshot utility when needed.
Am I trying to reinvent the wheel ? Is there a tool that could be used to generate these kind of images ? Or a simplest way to achieve my goal ?

ImageMagick's import can be used to capture window images using -window. Simply hide the menu, toolbar, tabbar, and scrollbar in the terminal before using. Use xwininfo(1) to get the window ID.
$ import -window 0x145cba2 terminal.png

Related

Timing effects in slides made with LaTeX

I'm trying to create a presentation with class Beamer in LaTeX. I learnt how to use command like \pause, \only and \onslide but I don't understand how to program with a specific time the effects I've inserted in the slide.
For example, I've the following piece of code
\includegraphics<1>[scale=0.3]{photo1.eps}
\includegraphics<2>[scale=0.3]{photo2.eps}
What I want is... "Dear LaTeX, show me first photo1.eps and after 5 seconds, for example, photo2.eps, on the same slide, of course", automatically, without my action.
Is it possibile to do that??? Can anyone help me??? Thank you in advance
I think you can use the \transduration command, as explained on page 142 in the beamer manual:
You can also specify how long a given slide should be shown, using the
following overlay-specification-aware command: \transduration<⟨overlay
specification⟩>{⟨number of seconds⟩} In full screen mode, show the
slide for ⟨number of seconds⟩. If zero is specified, the slide is
shown as short as possible. This can be used to create interesting
pseudo-animations. Example: \transduration<2>{1}

Offline Lorem Ipsum Bookmarklet

I'm looking for a very simple Bookmarklet which presents me with some Lipsum text. The ones I've seen generally make requests to a generator - but I want one which I can use offline (how often does Lorum Ipsum text change..?!).
Has anyone got any suggestions? It'd be nice to be able to specify how many paragraphs I want.
I've written this Bookmarklet. I've only tested in Firefox - it's simple, but meets my requirements. I don't have a Blog, so I thought I'd share it on Stack instead!
(though, I can't post the bookmarklet itself on Stack, so please see attached fiddle... also, the code is bodged together and not tidied up, but, it's functional for my need!)
.

Add text layer to PDF of scanned handwritten notes in OSX

While in class I like to take handwritten notes, afterwards I scan them and then type them up (helps me remember them and also makes them easily searchable). The main issue is I have is I use A LOT of drawings and complex math and converting the math formulas into latex (or word) is very time consuming and the drawings require that I keep the PDF and the text document. What I would like to do is take the basic text that I have typed myself (no OCR) and add a text layer to the PDF's that way the PDF's will be searchable and I can save a lot of time by not converting the math or drawings.
I've looked into Preview, PDFpenPro, acrobat, a couple of linux programs but so far I haven't really found anything that will do this.
Any idea of how I could do this or a program to use?
I also scan my notes. Sometimes I go back and add some text to them using this technique:
Open up the scanned pdf in Preview, then click on the "Edit" button in the top right corner, then the "Text tools" button on the left side (its a little box with Aa in it). From there you can drag open a text box and type into it.
Now the secret trick is that if you save it here as it is and try to open it in your ipad using PDFExpert or some other program then the text might not be there. So here's how to go through that slight hiccup: After you've annotated your notes how you want instead of just saving it as a pdf, use the Print option: File->Print or Command+P. Now click the PDF button on the left to "Save it as a pdf". Now that its printed you can open it and search it in any program that reads pdfs. Attached is an example.
One other thing, it seems like maybe you want to write over your existing handwritten text with typed text? I'm not sure if this is the best way. But if that's what I was trying to do I would:
Scan my notes
Read through them, typing them up as you said
Open the scanned notes in Photoshop or some other program
Draw a giant White Fill White Stroke rectangle over the handwritten text
Save it as a pdf
Do the technique above and copy and paste the typed text from step 2.
I hope this helps. And I wish you luck, I'm still working out the kinks myself for scanned notes but the possibilities have me pretty excited!
EDIT: I just checked out PDFpenPro, which I highly recommend because you don't have to go through that printing trick, you can just save the pdf document after annotating and other programs will recognize the annotations.

ImageMagick - Auto adjust the colours of an image a la other photo management applications?

Several photo management applications (e.g. Picnic on the flickr website, F-Spot on the gnome desktop), has the option to 'autocorrect'/'auto-fix' an image, which seems to adjust the colours in an image to make it look a bit better.
For example, here's a before:
and after
Is there anyway to do this sort of 'automatically adjust the colours to make it look good' on the command line with ImageMagick's tools (or other open source command line tools on ubuntu/debian). I have several hundred images that look at bit rubbish and I want to try putting them through this sort of filter.
Alternatively, what would be the name of this sort of effect?
What you are looking for is something to help you correct the white-balance of photos.
If you search for imagemagick auto white balance on any popular search engine you will get quite a feew results that are relevant. Sadly, http://www.imagemagick.org seems down at the moment.
I myself found a shell script called autowhite, and used it
me#sophie:[...]$ ./autowhite.sh 5498758807_59a80b3c50_m.jpg corrected.jpg
and the result is perfectly acceptable:
Original:
Corrected:
There are some options to the script, so if you're not really satisfied with the result you'll able to tweak it a tad.

How to import GIF files into Beamer presentation?

I need to import animations from Maple into my LaTeX/Beamer presentation. I save a file in GIF format. But later I have problems converting that file into PNG. All I get is a static PNG file and can't proceed ((( What's the full code to do that in LaTeX?
You can use the animate package to animate a series of PNGs. To get the series of PNGs from an animated GIF, use a tool like ImageMagick's convert.
Does this help: LINK? (This is the same answer as marcog... just wanted to provide a reference to it being asked previously -- the solution was the same: the animate package).
Also, your OS will matter. I don't know that Linux (not saying you're using it) has any ability to play animated PDFs. I've tried embedding movies using LaTeX and while it "works," you can't actually view them in anything Linux offers yet. Okular is working on it, but last I checked (couple months?) it's not possible yet.
Anyway, just wanted to add that just in case you were doing everything completely right and by chance are not seeing the fruits of your labor since you're using a Linux viewer. Check your work with Acrobat on Windows to be sure.

Resources