A Tribute to IrfanView

IrfanView is the best daily-use image viewer, period.

OK, maybe not for everyone. But for a power-user, that statement holds true. It’s the best general-purpose image editor I have ever used since a long time (2004), and it managed to keep that title for all these years in the midst of so many new Windows releases. It supports all the Windows versions from the ancient Windows 9.x to Windows 8. It is extremely snappy and unbelievably lightweight, with an install size of just about 2 MB (12 MB if all plugins are installed).

A Heads up: IrfanView looks old-school. It doesn’t conform too well to the latest GUI eye-candy standards (to keep compatibility with older Windows versions, I guess). The window border inherits the Windows theme, but the toolbar has always been pretty basic, with just bitmap skinning. If you’re just out for an image viewer which can browse through folders and do slideshows, then there are much prettier alternatives. I for one love Picasa’s image viewer.


As a Viewer

IrfanView is a very capable image viewer if you’re looking for a no-nonsense experience. It supports everything you would expect in a good image viewer, like browsing through folders, zooming in and out and viewing slideshows. But in addition to that, it also supports a lot of file formats for viewing and saving. Animated GIFs are supported too, and my most favourite: PSD files! You can’t edit PSD files but you can view them just fine.

Viewing images

As an Editor

Let’s be clear on one thing: IrfanView isn’t Photoshop. It doesn’t do layers or layer effects, it has very limited support for transparency when editing images, it doesn’t have brushes, a Pen tool or a Clone tool. But for everything else, there’s nothing better. You can:

  • Crop and auto-crop images
  • Resize/resample images, set their DPI
  • Do basic drawing (hit F12 and you’ll see)
  • Change the color depth
  • Cut/Copy/Paste rectangular parts of images using the selection tool with pixel-precision
  • Add text and watermarks
  • Create Panorama images (no intelligent stitching though)
  • Capture the screen (full screen/client area, include/exclude mouse cursor, open in editor/save to file, custom hotkey, timed auto-save)
  • Apply effects (Sharpen, Blur, Zoom Blur, Radial Blur, Noise, Pixelize, Explosion, etc.)
  • Do color corrections (RGB, Brightness, Contrast, Gamma, Saturation)
  • Switch RGB channels
  • Save to many output formats and control their settings
  • And God bless Irfan Skiljan, Batch Conversion with a bunch of options! Open-mouthed smile

Built-in effects

And these are just the features that I use and like. It’s also capable of some other crazy stuff like creating standalone slideshows and screensavers of those slideshows with an option of attaching mp3 files, extract icons from EXEs and DLLs, and much more.

It also comes with a Thumbnails application which is used to browse the supported file formats as thumbnails (I never use it though).

The Thumbnails application

 

A few tips

If I’ve managed to convince you to give IrfanView a shot, then I’m sure you’re heading to the website right now Winking smile

IView_GetIrfanView

I suggest that you download the the plugins pack too, especially if you’re a power user. You never know when you might need them. With the plugins installed, the install size is only about 12 MB, so no loss there.

IView_GetPluginsToo

 

After you install it, be sure to go through the settings. You’ll want to tweak some of them to make IView your own. BTW did you know IrfanView was designed also to be used as a very comprehensive command-line tool? I’ll say it again. IrfanView is the best daily-use image viewer out there. Period.

Stereoscopic 3D

Howdy, folks! It’s been a while since my last post. Well, I’ve been busy, but I’ve been lazier, hehe😀 Anyway, most of you might have seen the Avatar movie, and in 3D too, probably. Wasn’t the experience amazing? I wouldn’t know, because I only got to see the 2D version ;_; Anyway, today I’m going to explain how 3D works.

Note: Though you will find instructions, this is by no means a tutorial and was never meant to be. It’s only a descriptive guide to help explain the process better.

So basically…

What is 3D?

3D stands for 3 Dimensions. Now what are dimensions? In the world of mathematics, physical space can be represented in up to 3 dimensions.

An example of a 1-dimensional figure would be a straight line. All measurements are limited to only one constraint: length.

The only measurement is the length. Even a dot can be a 1D image (though, a dot is defined as a figure with zero dimensions... math is funny, eh?)

A square, a triangle or anything you can draw on a paper is 2-dimensional, meaning those figures can be represented with the help of length and width.

Anything you can draw on a paper qualifies as a 2D image.

Now, a cube, a cone, a pyramid, a pizza, the Taj Mahal, even you, are 3-dimensional. These objects can be represented in 3 dimensions namely length, width and depth.

Most real objects are 3D.

Most of what you see in a book, on the computer screen and in the movies is 2D. Sure, you can make out the depth of the objects shown on the screen, but that’s because your mind simply concludes that there’s depth, based on what it already knows, even though it doesn’t feel the depth.

You can tell that the cylinder is behind the cube even though you can't "feel" it.

What is depth?

Now how does your mind perceive “depth”? Well, it’s simple. When you view something with both your eyes, what do you see? You see just one picture, or that’s what you think. In reality, you see two different pictures, one with each eye. Try it out, look at an object by closing your eyes alternately. You’ll realize that you’re seeing the object from two slightly different angles. This, ladies and gentlemen, is the key to 3D. When your eyes send their signals to the brain, it merges them together and calculates the depth in the image.

This is how your mind sees two images as one, perceiving depth. Observe the slight variation in how each eye sees the image.

Now we know that the brain processes two separate images into one to get the sense of depth. How is this knowledge used to replicate depth through 2D media (computer screen for example)? Let’s explore that.

Replication

We have one main point to take away from the previous explanation: depth can only be simulated by feeding the brain two different views of the same scene. This is the reason we don’t feel depth when we watch something on the computer screen: both our eyes see the same image.

To simulate the sense of depth one has to find a way to view two different images at the same time through different eyes. Let’s discuss the process with a 3D picture, because I actually made a few B)

So my aim is to make this scene 3D:

I take two pictures from slightly different angles. Each picture is how each of my eye sees it separately:

These two pictures represent the target as seen by the right and left eyes.

Now I superimpose (combine) them:

Both images super-imposed.

But when I look at this pic, I can see both the views with both the eyes. How do I make it so that one image reaches one eye and the other image reaches the other eye separately? The answer is that I use some form of filtering.

One simple thing I can do is, I use colour filtering. It means that I will colourize each picture with a different colour like this:

Both images are colourized.

Now I’ll superimpose them again:

I superimposed the two coloured images, this is the result.

OK, now the pic is ready. How do I see the pic? with these (or similar):

Notice the colours. The left frame (from our point of view) has a red filter and the right frame has a cyan filter (have you noticed that they’re contrast colours?). Now when I look at the pic with these glasses on, my left eye will only see the red-colourized part of the pic and my right eye will only see the cyan-colourized part; mission accomplished! I get to enjoy the depth in the picture!

You can make a crude version of these “glasses”. You’ll need:

  1. Red and cyan sketch pens
  2. A colourless transparent sheet of paper or plastic (like a CD jewel case)

Just take your transparent material and colour them with the sketch pens, and you’re done😀 Of course, you might not find the exact shade of colours, so you might still see double-images when you view the pic, but you will feel some depth.

Showtime!

This is how 3D movies are made. The movie is shot with two cameras with filters covering the lenses. They combine the two reels and publish the movie. You are given “3D glasses” which are nothing but filters, which separate the two images projected on the screen and send them to the respective eyes.

Of course, there’s another more refined form of filtering than the red-cyan / yellow-blue filters: the polarized lens filtering. These glasses have dark lenses and kinda feel like shades. These type of glasses are what you probably used when watching a 3D movie, not the old coloured ones. The advantage is obvious: no colour distortion. When you use coloured filtering, a lot of colour detail is lost, but with polarized lenses, you get the full spectrum. Polarized lenses are basically filters too and they involve some concepts of optics which I will not be explaining in this post.

Check out the pictures in this page to get a good idea of how 3D movies work. (Maybe it’s explained better there than here ;_;)

There are also other methods to simulate depth (like Chromadepth). Hopefully, someone will come up with a solution which lets us enjoy 3D in everyday television and computing😀

nVidia 3D Vision

nVidia has come up with a wonderful technology called nVidia 3D Vision. The concept is basically the same, but it applies it to 3D games and the result is amazing. Now that’s what I call innovation! Well, not exactly, it’s pretty obvious once you see it, but it’s about time someone implemented it!

Note that nVidia 3D vision has two forms: nVidia 3D Vision and nVidia 3D Vision Discover. 3D Vision Discover just lets us experience 3D, but in a crude way (using red-cyan glasses). The real thing uses shutter glasses and requires a 120Hz LCD monitor. Though, I’ve come across posts that claim it’s not a strict requirement. I enjoy my games using the red-cyan glasses since I don’t have an LCD monitor (let alone a 120Hz one!). There’s a rather annoying limitation: 3D vision only works in Windows Vista and above, not in XP. There might be some mods out there which enable 3D vision in XP, but I haven’t found them. If you know, drop a comment and I’ll add it here🙂

If you happen to make or acquire 3D glasses but the colours don’t match with 3D vision defaults, you will still see double-images and it kind of hurts your eyes. I did a search in Google and found this registry hack which allows you to define the anaglyph colours. Here’s what you do. Open notepad and paste the following into the document:

==Start copy from below==

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\NVIDIA Corporation\Global

\Stereo3D]
@=””

“LeftAnaglyphFilter”=dword:ffff0000
“RightAnaglyphFilter”=dword:ff00ffff

“StereoGamma”=dword:3f800000

==End copy above==

Change the bolded parts in the lines:

“LeftAnaglyphFilter”=dword:ffff0000” and
“RightAnaglyphFilter”=dword:ff00ffff

to represent your desired colours in hex code. Don’t get confused if you don’t know what that is. Head over to this site and you can generate the hex codes for any colour. Of course, there are many other sites like this, just use google🙂

After you’re done, save the file as “3dVision_color_mod.reg”. Run the file and accept the prompt, you’re done. If you didn’t backup the original colour codes, you can use the text above, it’s the default setting.

Conclusion

If you ever acquire a set of 3D glasses, just do a google image search for “3D image” and you’ll get loads of fun pics to look at. Always remember that Google and Wikipedia are your friends (here’s the Wiki page about anaglyph images). Having explained this, I now have a question to all of you: can a person with only one eye experience simulated 3D? Rack your brains, until my next post >:)

That’s it for today, see you next time!

PS: Why did I use “colour” instead of “color”? Well, that’s the spelling I knew from childhood and that’s what I’m used to. It’s correct according to British English. I do use “color”, but only when I’m coding😛

Xbox 360 Controller for Windows: Review

Photobucket

I bought it recently (7-Jan-2010), as I mentioned in my other post. I did some research as I did with my graphics card (though not that much, I really went all out then) and the reviews and reception seemed to be very good. My other choice was the Saitek Cyborg Rumble Pad and I still have a feeling I would’ve liked it. In the end, I had a choice: if I got the Saitek Cyborg Rumble Pad, I would have a switchable analog/D-pad module. If I got the Xbox 360 controller, I would have the 2.5 mm earphone jack. I decided to go with Saitek Cyborg but when I went to the market, it was nowhere to be found. After much effort, I bought the Xbox 360 controller for a very good deal and saved Rs.450 (about 9 USD).

I followed the instructions and plugged in the gamepad after installing the latest drivers from the website (CD had v1.2, I downloaded v1.3). It worked without a hitch, as expected. The top-left quadrant of the “Ring of Light” (the green glowing circle at the center) lights up whenever I plug it in, indicating that I’m player 1 (I’m the only “player” connected to the PC, I don’t use Xbox Live for any games). I like it a lot, as I happen to be a fanatic of things that glow😉 The most superior aspect about the controller is it’s comfort, it’s a delight to the hands. I didn’t really take it seriously when all the reviews praised this fact but when I held it for the first time, I knew exactly what they meant. After using a cheap make of a PS2 clone controller for 3 years, I just had to smile. The weight is much better on my hands. It’s very light compared to my old controller, but it’s not too light either. I can feel I’m actually holding something and that’s the way I like it. I also love the colourful buttons A, B, X and Y. They bring a lot of life, along with the ring of light. Speaking of the ring of light, upon pressing the Guide button (the large X button inside the ring of light), a small indicator comes up on the screen indicating the status of the controller and the number of players. I’m posting through Ubuntu right now and I didn’t get a screenshot, I’ll update the post when (and if) I get one. The indicator doesn’t really do anything and it’s kinda vain, but hey, the Guide button does something🙂 Oh, did I mention, the wire is a whopping 3 meters long! It also has a safety feature, a plug-like thing which gets separated first when the wire is pulled, protecting the ends of the wire. All of this makes the wire a little heavy, but it’s no big deal.

As for complaints, I do have a few more than I hoped. First, the lack of customizability with the default drivers is really disappointing, especially to a tweaker at heart like me. There are other drivers out there which promise a lot (really a lot), but they’re not properly compatible with Windows 7 yet, so I held back. Of course, I use the latest free version of Xpadder, so I do have some control over useful aspects like keyboard and mouse mapping and finer aspects like the dead zone settings for the analog sticks and triggers. Next, as much as I like the glowing ring of light, I dislike only a quarter of it glowing. I never connect to Xbox Live and I don’t see myself doing it in the near or far future, so I’d rather have the whole ring glowing. With only a quarter glowing, I feel like the poor old LED’s gonna pop out sooner than the others (and me being a little obsessive compulsive, the thought of a quarter of light missing is unnerving). Next, the Start button is used to pause majority of games and it’s hard to reach. Well, not exactly, it’s placed in perfect vicinity to the A, B, X, Y buttons, but the right analog stick comes in the way. Let me show you what I mean:

Photobucket

It might not look like much in the picture, but during gameplay, it’s a bit annoying. There’s another thing I didn’t see coming, and it has to do with the left analog stick. Remember the Saitek Cyborg Rumble Gamepad which had a switchable analog/D-pad module? I thought it was just a fancy feature, but now I find it rather useful. Sure, playing many games feels absolutely great with the analog stick, but I’m a gamepad kinda guy, I play most of the games with a gamepad when I can whether the game supports it or not (courtesy, Xpadder). I also happen to be a fan of old school RPGs and the analog seriously undermines gameplay. Even with customized deadzones, it just doesn’t feel right. I would use the D-pad, if it were a little more comfortable, but Xbox games use it as an accessory rather than for real directional control, and it’s only one large chunk of plastic. Moving it around doesn’t feel comfortable. In this aspect, my old gamepad takes the cake. Since it’s a PS2 design, it has the D-pad for main directional control and it has 4 separate buttons for each direction, which I really miss with the new gamepad. Finally, I really dislike the fact that the Guide button does nothing useful. In the Saitek gamepad, it’s used to switch between “normal” and “FPS” configurations, which is pretty slick. I wanted something like that, but alas, it’s not possible without the XBCD drivers I mentioned earlier.

Final verdict: despite the problems, I’m thoroughly enjoying it! For instance, playing H.A.W.X on it is just divine! I’m soon going to get myself a 2.5mm to 3.5mm adapter for plugging in my earphones and it’ll be all the more enjoyable.

And now, behold! Some pics for thine eyes!

Photobucket

Photobucket

The 2.5 mm headset jack. Meant for a Microsoft headset specifically made for the Xbox 360, but it’ll detect pretty much anything as a USB device:

Photobucket

Fits pretty well in my hand:

Photobucket

And a pic I wish I’d taken under better lighting and focal settings:

Photobucket

That’s is for today people, take care.

Idea for a queue-based File Transfer Utility

I got an idea. I could go on about what inspired idea but I think I’ll just bore myself. I’ll just say that it’s out of need, and it’s just sad someone’s not already done it. Here’s the sketch of what’s on my mind:

  • It’s a GUI wrapper over some simple commandline tool (basic DOS commands to start with, might look into Robocopy later).
  • The goal is NOT to achieve a speedy file transfer (like Teracopy for example). The main point is proper queuing support.
  • Design should be simple enough for someone to pick it up and start using it immediately. It’s a file transfer utility, not the dashboard on a space shuttle.
  • I want this to be cross-platform someday (at least Windows and Linux), the GUI will simply make use of commandline tools. I’ll start with Windows and once it meets some basic requirements, if I have time and more importantly if I feel like it, I’ll work on a cross-platform version.
  • Tool of the trade: wxPython.

The features I want to implement first:

  • Cutting/Copying files adds them to a queue (I’m thinking take over Ctrl+X and Ctrl+C). It’ll basically be like “Enqueue in Winamp”.
  • Before pasting the queue, you can view and edit the queue. Then Ctrl+V or paste will move/copy those file in the order of the queue one after another. Note: I need to investigate parallel file transfers, but for starters, I’ll stick to one file at a time, based on my experience that multiple transfers take more time than the individual transfers combined.
  • As soon as a file is copied or cut, the queue window appears in an always-on-top (non-optional) and transparent (optional) window.

I’m not the type to plan everything out in the beginning, I like to get out a prototype and chalk out the plan as I go along, even if it means a lot of rework along the way. It’s just how I’m comfortable doing things. So basically, when I’m in the right mood, I’ll draw some mockups and whatnot and start from there but in the meanwhile, I gotta get comfy with wxPython, at least the basics. More updates as they come, no particular ETA.

Peace.

How I recovered from a bad theming attempt

Have you ever heard of UX theme Patcher? It allows you to apply unsigned themes on Windows (basically most of the interesting themes you can find on the internet). deviantART and many other websites have some amazing themes but they can’t be used as they are not signed by Microsoft. Another reason is that some of these themes modify/replace some system files (explorerframe.dll, shell32.dll, explorer.dll) to theme elements like the back/forward buttons in explorer, the start button, etc.

Since these themes provide modified system files, we need to make backups of the originals (note the Windows Service Pack). There are tools to manage themes by changing the system files automatically (Theme Manager is my favourite). I was using it to set some theme, but something must’ve gone wrong. explorer.exe got corrupted somehow and it was not starting on boot. And I had no backup of the original. If Theme Manager made a backup somewhere, I couldn’t find it.

I restarted the PC and hit F8 during boot to bring up the extended boot menu. I thought I’d find “Startup Repair” there, but I was wrong. All I got were a bunch of Safe Modes and a few other options. Luckily, my decision to have an Ubuntu dual boot proved helpful. I booted into Ubuntu and got online for solutions. I kept seeing a command: “sfc /scannow” all over the forums everywhere. What that command does is check the integrity of all the system files (by verifying their checksums, probably) and is if finds any corrupt files, it replaces those with the original file stored in the repository (C:\Windows\winsxs). So I booted back into windows, but there was no explorer again. I didn’t even have my desktop. I logged into my user, hit Ctrl+Alt+Del, and got to task manager. Tried File –> Run –> explorer without luck (obviously, since explorer was corrupt). I started cmd.exe and ran “sfc /scannow” but alas, I had to have admin privileges to run that command! And I couldn’t for the life of me figure out how to start a cmd prompt with admin privileges. All the posts on the internet were describing the GUI way (from the start menu), but I didn’t have a start menu without explorer. Then I somehow found this blog post about a nice utility written in C called elevate. With the help of that, I was able to start an elevated cmd prompt, run the “sfc /scannow” command, and reboot into a working windows session Smile

So the summary:

  • Always make a backup of all the files that you will change when you theme.
  • Theme Manager is a great tool for managing Windows themes.
  • Should something go wrong, run “sfc /scannow” with “elevate.exe

Have fun theming Smile

The Future of this Blog

I haven’t been blogging much lately because, well, I’m pretty lazy. And I haven’t had much free time. More truthfully though, I’ve lost my touch. There were some pretty big life changes, I got a job, for starters. My blogging habits took a pretty hard hit due to that.

Luckily, I’ve spent the last Saturday reformatting and re-installing OSes on two computers. Tiring and even frustrating as it was, it helped me get back in touch with the tech enthusiast in me. So I guess I’ll start blogging again.

All the same, I did some thinking about what this blog is all about, and there is some good/bad news.

Bad news first: This is not a tech blog. It is my tech blog. Meaning, I use this blog to archive my findings, my subjective opinions on all things tech. It is not really a place to find unbiased, objective hardcore tech info and certainly not Tech news, oh no. There are many good blogs out there which already do that and I don’t like doing tech news except for the occasional post where I’m genuinely interested in the information. It is also not a place to expect frequent updates

Good news: This is just a practice blog. Once I refine my writing style and get comfortable with blogging quality content with relative ease, I’ll create a new blog and move the non-personal content over there. That, will be a full-blown tech blog, and this will be my journal.

Now that that’s clear, well, I’m back! Smile

Under-used Keyboard Shortcuts for Text Editing

Most people know about the basic windows shortcuts for Cut, Copy and Paste (right? Smile with tongue out), but there are a few more shortcuts that I consider are invaluable when writing text. And I was surprised that most people don’t really use them. I am talking about the Home and End keys and their respective combinations with Ctrl and/or Shift keys.

  • Home: Takes the cursor to the beginning of the current line.
  • End: Takes the cursor to the end of the current line (after the last character in the line).
  • Ctrl + Home: Takes the cursor to the very beginning of the active text field/document.
  • Ctrl + End: Takes the cursor to the very end of the active text field/document.
  • Shift + Home/End/Right/Left/Up/Down: Selects all the text between the initial cursor position and the final cursor position.
  • Ctrl + A: Selects everything in the active text field.

All coders and pretty much everyone who types a lot of text in your everyday life, for the love of God, drill these shortcuts into your minds! I promise your productivity will increase at least by 30%.  Here are a few examples of usages:

  1. Example 1 (Ctrl + A): Say you want to post a rather long status update in Facebook and twitter. Type out your message, hit Ctrl + A, then Ctrl + C. Then hit the post button in Facebook, go to Twitter, click on the “What’s New” text box, press Ctrl + V and post it.
  2. Example 2 (Shift + Home): Say you’ve written a complex printf() statement in C to display some information and you have to repeat the same output with a few changes about 5 times. Here’s what you do: Type out the first printf() statement. Your cursor will be at the end of the line right. Now press Shift + Home. The cursor will move to the beginning of the line because of the Home key, but it will also select all the text along the way because of the Shift key. Now copy and paste it as many times as you want. You have thus successfully avoided moving your hand to the mouse, moving the cursor and selecting the text by mouse movement. You’ve achieved all that in just 2 keystrokes: Shift + Home, without taking your hand off the keyboard. Note that you can use Shift with the arrow keys to select text letter by letter.

Aside from these shortcuts, I implore you to familiarize yourself with the keyboard shortcuts of the programs you use the most. It will drastically reduce the time needed to perform simple but repetitive actions. Just use Google, because as they say, Google is your friend! And if you don’t listen, then this Smile with tongue out

Ciao!

The odd details of C++

I’m revisiting C++ with the intention of figuring out the details. This post will contain various little things and questions and pretty much anything. I intend this list to be “something that you won’t typically find in most books”, a list of the details of the C++ language. Not to mention, this page will be changing constantly as I add new information or get answers to questions listed.

Legend:

(?) – Still needs confirmation, some info missing.

And the list begins:

  1. Structured vs. Object oriented programming: Structured programming is task-centric where as object oriented programming is object-centric. For example, in structured approach, when a task is to be performed, we first think of subroutines and then the data structures. In OO approach, we first think of the objects needed to perform the task, then we design the details of the objects and their behaviour. C is a structured language, C++ is an object oriented language.
  2. (?) Default values for data types in C++: When variables are declared and not initialized, what are their values? I believe number types will be set to 0, but it might depend on the compiler. For example, C-Free 4 gave garbage values to int, float and char variables. But when run multiple times, the value for int kept changing but the values for float and char remained the same. Confirm.
  3. (?) String Mutability: Need to explore string mutability, even by using pointers. For example, when I have a char pointer, can I still use it when I change the string length?Also need to explore String class capabilities.
  4. Static variables and functions: Figure out 1.Where static variables can be a.declared b.initialized and experiment on their scope.

Tasty Static – the modern day SkyRoads remix

Fans of BlueMoon Interactive’s DOS game SkyRoads, rejoice! I found an excellent remake of the classic: Tasty Static. The game is FANTASTIC, take my word for it Open-mouthed smile Or don’t. Just check the screenshots and the trailer.

The basic gameplay is the same as SkyRoads, you have to reach the end of a road by jumping and moving on differently setup platforms. There are different types of platforms, ones which make you go faster, slow you down, lava blocks which burn you on contact and bumpy blocks which make you hop when you touch them. There are also a few extras like shooting lasers and backward mode. The visuals are very nice. The ship and all the other effects are simple polygons, but they still manage to look fantastic. The best part about the game, though, is the sound track. I can’t describe it in words. Tasty Static is freeware, so just head over to the website and download the game. Did I mention it comes for Windows, Mac and Linux operating systems? This game is truly a gem, and it inspires me to see such amazing work in the freeware domain.