Export images from a PDF file

I have previously written about how to export each of the pages of a PDF file as an image. That works well for, for example, presentation slides that should go on a web page. But sometimes there is a need to export only the images within a page. This can be achieved with a small command line tool called pdfimages.

One way of using it is:

pdfimages -p -png file.pdf image

This will export all images in file.pdf and label them with something like image-001-010.png, where the first number refers to the page and the second is a count of images.

Sometimes I just take a screenshot if I want to grab something from a PDF. But this is a more robust method if you want to grab several different images from a PDF file.

Different 16:9 format resolutions

I often have to convert between different resolutions of videos and images and always forget the pixel dimensions that correspond to a 16:9 format. So here is a cheat-sheet:

  • 2160p: 3840×2160
  • 1440p: 2560×1440
  • 1080p: 1920×1080
  • 720p: 1280×720
  • 540p: 960×540
  • 480p: 854×480
  • 360p: 640×360
  • 240p: 426×240
  • 120p: 213×120

I also came across this complete list of true 16:9 resolution combinations, but the ones above suffice for my usage. Happy converting!

Create timelapse video from images with FFmpeg

I take a lot of timelapse shots with a GoPro camera. Usually, I do this with the camera’s photo setting instead of the video setting. That is because I find it easier to delete unwanted pictures from the series that way. It also simplifies selecting individual photos when I want that. But then I need a way to create a timelapse video from the photos easily.

Here is an FFmpeg one-liner that does the job:

ffmpeg -r 10 -pattern_type glob -i "*.JPG" -s 1920x1440 -vcodec libx264 output.mp4

To break down the different parameters a little:

  • -r 10″: the framerate (fps)
  • “-pattern_type glob”: to allow for selecting all JPGs using “*.JPG”
  • “-s 1920×1440”: downscales the images to a pseudo-like HD format
  • “-vcodec libx264”: force to use this codec