IrfanView: Batch Operations on Images

The ImageMagick basket of command-line tools can be used to do almost anything to a set of image files. But, sometimes figuring out the options to pass the tool can be too much work for a small batch operation. IrfanView, (still) the best image viewer on Windows is the next best tool for such quick operations.

  • Choose FileBatch Conversion / Rename to apply batch operations.
  • Rename files. All sorts of numbering can be added as prefix or suffix to the files.
  • Crop, resize, rotate, flip or almost anything imaginable can be applied on the files.
Advertisements

TeX: Kannada using XeTeX

LaTeX neither supports Windows fonts nor Unicode text. This makes creating documents in Indian languages with LaTeX very hard. But, there is a solution: XeTeX. It extends the TeX implementation to work with Windows fonts and Unicode text.

If you are using MikTeX on Windows, XeTeX is already included in its default installation! Here is how to obtain the Kannada PDF shown above:

  1. Create a kannada.tex file with this text:
    \documentclass{article}
    \usepackage{fontspec}
    \setmainfont[Script=Kannada]{Tunga}
    \begin{document}
    ಏನಿದು ಲಾಟೆಕ್! ಗೊತ್ತಾ ನಿಮಗೆ?
    \end{document}

    Script indicates the language (Kannada) and Tunga is the name of a Kannada font on Windows. The Kannada text was typed using the Baraha IME transliteration software.

  2. Make sure to save the file as UTF-8 or any other Unicode encoding.
  3. Compile the file to PDF using xelatex, which is latex built on top of XeTeX:
    $ xelatex kannada.tex

That is it, it is that simple! 🙂 To create a PDF in a different Indian language, change the respective parameters in \setmainfont.

How to split window in Eclipse

I like working with split editor windows when comparing code from 2 different sections of a file or different files. This is easy to do in Visual Studio (see here). It is just as easy in Eclipse too, though not obvious if you merely look through the menus.

[ To split a window, just grab hold of a tab and pull it to the side until it turns into a black arrow. ]

[ Leave it and it turns into a new window with a new tab group. ]

To have split windows with the same file: Choose WindowNew Editor. That creates a new tab of the open file. Pull that tab as above to split the window.

For a horizontal split, pull the tab to the bottom of the window.

Keyboard shortcut for horizontal split: Ctrl+Shift+_
Keyboard shortcut for vertical split: Ctrl+Shift+{

Tried with: Eclipse Luna 4.4.1 and Ubuntu 14.04

Logitech Quickcam IM on Windows 7

At work I use a Logitech Quickcam IM (Model Number: V-UBB39) webcamera bought in 2006. After I installed Windows 7, I needed to reinstall the drivers for this webcam. I could not find the installation CD of this webcam. (Who keeps around installation discs in this age anyway?). Checking the Logitech website for drivers, I was surprised to see that this webcam is no longer supported! However, the Windows 7 Compatibility Center listed the Quickcam IM as compatible. Surely they must have used some driver to check the compatibility!

Google led me to some shady looking websites offering the old drivers (Quickcam 8.x) which supposedly are meant for this webcam. I tried to install them and they did not work. My suspicion is that they are meant for Windows XP and would not work on Windows 7 due to the large changes in the driver model starting from Vista. I needed a driver written for Vista or later for the Quickcam.

Giving up on finding the Windows 7 drivers for Quickcam IM, I decided to install the drivers of Logitech Quickcam Connect, since it looked the most similar to my webcam. Windows 7 warned me that there are problems with Windows 7 and Quickcam drivers! I continued, the installation went through but failed when I plugged in the webcam! 😦 The error dialog mentioned that one of the reasons for this could be due to installation by a non-Administrator. I had installed by elevating from a Standard User to Administrator. Ideally, this should work, but looks like the Quickcam developers have not put in enough effort to make this work. Sighing, I un-installed the drivers and installed again after explicitly logging into an Administrator account. The Quickcam IM webcam works now with Windows 7. 🙂

The webcam works, but the 3 years of experience with Logitech webcams has left a bad taste in my mouth. Quickcam drivers and software have always given me problems, both on Windows XP and now on Windows 7. Fixing these issues have always involved multiple trials, reboots and lots of wasted time. I really do not see why their webcams cannot function without their drivers as a generic USB webcam device to Windows, which many cheap webcams can!

Motorola E6: Software Version

It is essential to know the software version of the Motorola ROKR E6 if you like to mod it. To see the software version:

  1. Bring up the dialer.
  2. Dial WWW008W and press Call. (W is the wait character, which can be inserted by choosing MenuInsertInsert Wait.)
  3. The software version is displayed in a dialog. The dialog disappears in a few seconds.

The version my E6 shipped with is R533_G_11.12.02P.

Videos: From web to cellphone

I do not have an iPhone or an Android cellphone, but still there is a lot one can do with cellphones available today. I use my 2-year old Motorola ROKR E6 not just for listening to podcasts, but also to catch up on technical videos (like Google Tech Talks) which are interesting, but too long (~1 hour) to watch them at my desk.

The technical specifications of most cellphones are minimal, but enough:

  • The display resolution is not high. The E6 display is 240 x 320 pixels. It is pretty crappy for watching movies, but is enough to watch technical videos.
  • Supports playback of 3GP video format. The E6 supports 3GP video and uses RealPlayer to play .3gp video files. There is no restriction on the length of the videos, which is great! By tapping on the E6 RealPlayer while it is playing a video, the display switches from horizontal to vertical, which is good for videos since it is wider.
  • Videos cannot be watched off the Internet. The E6 web browser is pretty rudimentary and I doubt it will play any video content on the Internet. I do not care in any case since I do not even have a data plan! 🙂
  • There is support for some kind of storage device. The E6 has a SD card slot, and I currently use a 2GB SD card in it. I can copy over 3GP video files to the E6 over USB. The SD card appears as a simple USB Mass Storage device (thus, no drivers required, works like a charm everywhere).

Working with these minimal specifications, one can still enjoy any video off the Internet on the cellphone.

Download online videos

Get the Video Download Helper Firefox addon. This addon puts a button in the Firefox toolbar. When you are on a webpage which has embedded video content (like YouTube), just click on the button to download the video to a file (typically a FLV file). If you are looking at websites that offer videos in MP4, WMV, MKV or AVI formats, you can just download them directly. None of these formats or their high resolutions can be played on the cellphone, they need to be converted.

Convert videos to 3GP

Videos downloaded from the Internet are unlikely to be in the 3GP format. There are very few programs that can convert any video format you can throw at it into a 3GP file. SUPER is the best I have found for this jpb. The only output container choice which worked consistently on the E6 for me was the 3GP (Nokia/NEC/Siemens) option (see above screenshot).

Once converted to 3GP by SUPER, transfer the file to your cellphone and enjoy it on your commute! 🙂

Inkscape: Wacom Bamboo Fun

I bought my Wacom Bamboo Fun tablet more than a year ago. And from that time until now, it has never worked with Windows applications built with GTK+ like Inkscape and GIMP. The mouse cursor would freeze up the moment it entered the application window!

There seems to be some fixes in GTK+ now to ameliorate this situation. To fix this problem for Inkscape:

  1. Update Inkscape to the latest version.
  2. Download GTK+ 2.18 or later for Windows. Unzip the setup file.
  3. Replace libgdk-win32-2.0-0.dll in C:\Program Files\Inkscape with the same file from GTK+.

The Wacom Bamboo Fun mouse and pen should work fine with Inkscape now. Sadly, this does not fix GIMP to work with Bamboo Fun! 😦

Update: John Burnett has suggested an alternate solution that should probably work. Please see the comments below.

Adobe Acrobat: OCR

You have scanned in a paper or a section of a book and converted it to a PDF. What next? The next best thing to do would be to run OCR on the PDF.

I use Adobe Acrobat for this. The converted PDF document right now is only acting as a container for the scanned bitmap images. By running OCR on it, Acrobat can recognize text in the image and embed it along with the image. This way you can mark and copy text in the PDF. And also be able to search for text in the document.

To do OCR:

Choose DocumentOCR Text RecognitionRecognize text using OCR …

In the Recognize Text dialog that pops up the default options should be fine. Click OK.

The OCR then runs on each page serially and may take some time on long documents. You may also notice that the scanned images in the document get straightened a bit and may also get downsampled. After the OCR is complete, save the PDF.

ImageMagick: Convert images to PDF document

The convert command-line tool from ImageMagick is the easiest way I know to convert a bunch of images into a single PDF document. It is as easy as:

convert *.jpg paper.pdf

(Make sure the ImageMagick installation path is in your %PATH% environment variable for this to work from any directory.)

I typically use this to convert the scans of old CS papers. Even today there is a surprisingly large amount of old CS papers that are not available online in a digital format. The only option is to head down to the library, get hold of the journal and either photocopy or scan the pages. I always prefer to scan in the paper as JPG images, then straighten and edit the images a bit in Picasa and then convert it into a PDF document.

Windows: Fonts Folder

Windows Explorer displays the contents of the Fonts folder (C:\Windows\Fonts) in a special way. You may need to be aware of this if you need the complete path of a particular font. For example, as input to a command-line program (say adding text to an image using Imagemagick) or in your application code.

  • Explorer does not display the filenames of the fonts. You cannot see the filename no matter what kind of View you switch Explorer to.
  • Also, Explorer displays the fonts grouped by Font Family. (Note that the Fonts directory is actually completely flat, there are no subdirectories in it. The Font Family grouping is GUI sugar by Explorer.) Only obscure fonts which are alone are displayed as individual fonts. The Font Family is like a folder in Explorer, open it to see the individual fonts.

fontext.dll seems to be the special DLL that Explorer uses for displaying the Fonts folder. (C:\Windows\System32\fontext.dll) It can be observed that Windows creates a temporary fontext.dll.mui whenever the Fonts folder is opened in Explorer, this indicates that this DLL is being used. (.mui or MUI is Multilingual User Interface, a Windows technology to enable user interfaces in multiple languages on the same computer.) There seems to be very little information available about this DLL.

Anyway, to see the font filename, right-click the individual font and open its Properties. (For example, Consolas Bold turns out to be consolab.ttf)

Or you could open up a command window and look at the contents of the C:\Windows\Fonts directory. You will also notice that all the fonts actually have only a 8.3 filename! Even the newer Vista and Windows 7 fonts!

PS: I also noted with a tinge of sadness that the old Add Fonts dialog box had finally been laid to rest in Windows 7. It cannot be found or invoked from anywhere. This decrepit looking dialog box had been in Windows since the days of Windows 3.1 for almost 20 years (upto Vista).