Showing posts with label software. Show all posts
Showing posts with label software. Show all posts

Friday, January 17, 2014

PDF to animated GIF

In order to illustrate how fragmentation occurs, I created a PDF document (Fragmentierung.pdf) with one page for each step of the fragmentation.


 This is how I converted it to an animated GIF. The first step was to create a series of PPM files, one file for each page. The option -r 384 sets the resolution to 384 dpi. This somewhat odd resolution is four times 96 dpi which in turn is the resolution of the PDF being converted.


The pdftoppm command generates files that are numbered.


The files resulting from this conversation are huge in both display and storage size so the next step is to rescale them to a reasonable resolution. My choice was a width of 800 times 600. the for loop iterates over all PPM files, the output of the pamscale command sent to a file with a name based on the original file name using the shell's own capability to process strings. Finally, the --filter option controls how precisely the original high-resolution image is mapped to the low resolution one.

Let's assume the original file name is Fragmentierung-1.ppm. Then ${i%.ppm} yields Fragmentierung-1 and ${i%.ppm}_new.ppm results in Fragmentierung-1_new.ppm.


The result of this command - which on my old machine requires a considerable amount of time - is a new series of files that are considerably smaller than the original ones.


As the old files are no longer needed, I replace them with the corresponding new ones.


Now we have ppm files of the right size that are simply numbered.


The PPM files usually have more than 256 colors (which is the maximum for GIFs). For this reason I use pnmcolormap to generate colormaps for the individual files that have no more than 256 colors.


This command results in tons of diagnostics output created by pnmcolormap.


The next command performs two tasks at the same time: pnmremap uses the colormap to map the original colors to no more than 256 with the -fs option making sure that Floyd-Steinberg dithering is used. Then the output converted to GIF formatusing ppmtogif and is written to a file with the file name extension .gif.


In this case both commands are a bit chatty so you again get lots of output.


Now we are almost done as we have a set of GIF files.


Just discard all the intermediary files. The next command looks complicated like hell but it isn't. gifsicle generates an animated GIF from a number of input files that need to be in GIF format.

  • --loopcount=forever makes the animation loop forever (i.e. after displaying the last frame of the animation it always restarts with the first one)
  • --optimize=2 optimizes the generated file as much as possible (without this option the file gets even bigger)
  • --colors=256 makes sure that the generated file has no more than 256 colors. This may seem superflous as each input file already has no more than 256 colors but the colors may happen to be different so that the overall number can be larger than 256.

The most important part of the command is the --delay options. If you provide this option, it applies to each image that follows up to the next command. Hence, in this case the first delay of 3 seconds applies to Fragmentierung-1.gif only, the delay of 1 seconds to Fragmentierung-2.gif through Fragmentierung-8.gif and the second delay of 3 seconds to Fragmentierung-9.gif.


Finally done. Here is the animated gif that results from this effort.

Sunday, March 4, 2012

Termtter, a terminal-based Twitter client

Termtter is a terminal-based Twitter client written in Ruby that can be installed as a Ruby gem. In the easiest case you simply type in
gem install termtter
and you are done with installing the program, otherwise see How to Install.

Once termtter has been installed you can simply  run it provided that you do not need to use a proxy; in that case see Configuration. However, like any other Twitter application, termtter needs to be authorised in order to function properly.

Therefore, at the initial run, termtter will provide you with an authorisation URL.

First launch of termtter

Once you visit this URL, you will be asked whether you want to authorise termtter to use your Twitter account.

Visiting authorization URL

If you choose to authorise the application (i.e. termtter) you will provided with a PIN.

Obtaining PIN

After having obtained the PIN you need to enter it in termtter. Copy and paste will not work because the PIN is shown as an image.

Entering PIN

Now that termtter has been authorised you can use it at your liking.

Termtter at work

Wednesday, January 4, 2012

Adblock plus showing ads?

You may have noticed that recent versions of Adblock plus do not filter out certain ads. Here is how to get rid of this “feature”:

First you go to Tools → Addons → Extensions → Adblock Plus to open the Adblock Plus preferences and click on Filter Preferences…

Adblock Plus preferences
Alternatively you can right-click on the Adblock Plus Icon (an octagonal stop sign with the text ABP on it) to open its context menu and select Filter Preferences… or use the Ctrl+Shift+F shortcut. No matter which method you use, simply open the Adblock Plus Filter Preferences window.

In this window go to the Filter subscriptions tab and uncheck Allow some non-intrusive advertising.

Adblock Plus Fiter Preferences:
Filter Subscriptions → Allow some non-intrusive advertising
That's it.

Monday, January 2, 2012

FxIF

FxIF (Firefox exIF) allows you to view meta information data contained in JPEG images. Most digital cameras add EXIF data to all images you take and much editing software adds or allows you to add more informations on the picture and you the creator.

Install order for Firefox add-ons

Allow me to suggested an order in which to installing Firefox add-ons. Note that you typically need not restart the browser after installing each and every add-on. However, I cannot guarantee that not doing so will not run you into trouble.

First of all you should ensure that you keep the configuration free from unused options. In order to do so allow me to suggest that the first add-on you install is one that helps you with this (i.e. before you mess up the config).

Note that if you manually modify config settings it may be a good idea to document what you did. Otherwise you will sooner or later forget for what purpose you made which modification and it may even occur that you altogether forget that you made a certain modification – and chances are that you will need to recall precisely that forgotten detail.
  • Preferences Cleaner - Restart after installing this add-on to make sure that it is in place before you install anything else.
Now you should add some protective measures:
Once the above add-ons (or at least the ones in bold) choose from the other add-ons listed on this page. Allow me to start with a set of suggested add-ons that aim at tuning Firefox:
The purpose of the next bunch of add-ons is providing features to Firefox that are not site-specific:
This bunch of add-ons improve the GUI:
The next bunch is for looking up words and phrases:
Finally here is a bunch of quite site-specific tools:
You may wonder why I am so insane that I wrote this text. Actually this has little to do with sanity – the above documents in which order I actually added the listed bunches of add-ons after my Firefox config had gotten too messy ☺

2012-01-02, 17:46 UTC: I removed Easy App Tabs from the list as its feature is provided by Tab Mix Plus.
2012-01-02, 18:3 UTC: Added GoogleReaderPlus (forgotten)

Quick Locale Switcher

Quick Locale Switcher allows you to quickly switch to a different language (User Interface, Spell Checker Dictionary and Website content) in your Mozilla application.

Saturday, December 31, 2011

Preferences Cleaner

Preferences Cleaner allows you to automatically track installation or uninstallation of Firefox extensions. When uninstalling an extension, you can automatically remove all its preferences. Alternatively, you may opt to remove them later manually.

rikaichan

rikaichan is a Japanese to English/German/French/Russian dictionary. Just hover the mouse pointer over a word, and a popup with both the reading and the meaning appears. The add-on automatically de-inflects verbs and adjectives and has a detailed kanji view. For Dictionaries see http://rikaichan.mozdev.org/.

Perapera Chinese Popup Dictionary

Perapera Chinese Popup Dictionary allows you to look up the pronounciation and meaning of any Chinese word that occurs on a webpage by just hovering the mouse pointer over it. Dictionaries for English (built-in), German, and French are available, it supports Pinyin and Zhuyin as well as simplified and traditional characters.

Friday, December 30, 2011

Copy Link URL

Copy Link URL copies the URLs of selected links to the clipboard.

Extended Statusbar

Extended Statusbar provides a Statusbar with speed, percentage, time and loaded size (similar to Opera's one)

Multi Links

Multi Links lets you open, copy or bookmark multiple links at the same time rather than having to do them all individually.

HashColouredTabs+

HashColouredTabs+ improves tab identification by providing a small colored icon for any site which doesn't have its own favicon.

Is It Compatible?

Is It Compatible? displays Firefox or Thunderbird compatibility versions for each addon in the addons window

Load Tabs Progressively

Load Tabs Progressively limits the number of concurrent loading tabs and/or unread loaded tabs. A good idea if you have many open tabs and/or tend to open many tabs at once.

Print Edit

Print Edit allows editing of the web page content while in Print Preview mode. Editing the web page prior to printing can compact the layout and remove unwanted content such as adverts, sidebars and blank pages. Any element can be formatted, hidden or deleted.

Secure Or Not

Secure Or Not allows you to identify which links on a page are secure and which are not, where “secure” means an encrypted connection, nothing more, nothing less.

Hide Find Bar

Hide Find Bar hides the Find Bar after a certain interval of inactivity has elapsed.

Hide Tabbar

Hide Tabbar allows you to hide/unhide the tabbar by just pressing a key.

Open Image In New Tab

Open Image In New Tab adds a context menu item for opening images in new tabs.