RSS

ImageMagick

0 Comments | This entry was posted on Aug 30 2008

I’m running Kubuntu Hardy 8.04 and was working on a batch conversion script to resize JPEG files and make them look ultra crisp and sharp. I already managed to get a set of parameters for convert that I was quite happy with, but as I was tweaking a bit more yesterday, I found a bug in the software.

convert -version yields:

Version: ImageMagick 6.3.7 02/19/08 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC

When using the parameter -auto-orient images should be rotated according to the EXIF orientation tag. Seems like there’s a bug in this version, cause I can’t get it to work. I found a post in the imagick forums about the same problem:

http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=11925

Now I guess I just have to wait for the Ubuntu repositories to pick it up so I can get the newer version. Unless I can speed it up somehow, this bug is annoying. Meanwhile I’ll work around it using exiftool and/or jpegorient and/or exifautotran. *Sigh*

Keyboard rant

0 Comments | This entry was posted on Aug 30 2008

I’ve not blogged about this or many other small details about my life really, I like to keep many private things private and sometimes I don’t think my small observations are worth writing about. But I think it’s time for me to rant a bit about Linux and software on it. Not just for my readers, but for myself. Maybe I can come back in 5 years time and see if I was right. Oh, and prepare for a long post…

First the backgrounds: I consider myself a power user of operating systems and software, and I would think most people would agree. My work includes designing software for other people too, and my goal is usually to make software simple on the outside but complex on the inside for average users, but enable all complexity for power users like myself. I don’t like having a nerd or geek label on myself though, but I demand lots from my software as any professional would from their expensive power tools. If at all possible, I operate the computer without a mouse and navigate all applications with the keyboard and demand that all applications have good keyboard support. Even on Windows I many times preferred the command line for many batch operations.

Having switched completely from Windows to Linux and the KDE 3 desktop environment, I find myself relearning a lot of basic ways to navigate the system. At first I had custom key bindings that resembled Windows (such as Win+R for run command instead of the KDE default Alt+F2), but after a partial reinstall of some libraries I lost the configuration and use more and more “Linux style” (KDE style) keystrokes. Having a custom set of key command is of course practical for myself, but anyone else using my system would have a hard (or impossible) time to do anything quickly. Security through obfuscation comes to mind, but that’s another topic for another day.

The benefits of having a custom set of keystrokes is of course more operating speed for me, but downsides may be far too many I fear, that I should use them. While I learn my specialized system, some of my unique commands will be stuck in “muscle memory” that aren’t applicable to other systems. So who knows what will happen in some other random system (my clients, friends, family etc.) if I suddenly hit Win+T or Win+Shift+E etc. that may have some meaning on my system, but another on theirs. Sometimes I quickly hit a keyboard command realising too late, that this command is not available on this other system. After a solid 7 months of using Linux, the less I remember how to use Windows. Some would congratulate me for getting away from the Windows habits, but that doesn’t really go well for a computer specialist, who needs to know a fair deal about every system around, and not do any damage when using a borrowed system. Pressing Ctrl+Alt+Del in Linux may initiate a reboot, while in recent versions of Windows it just opens up the task manager. I’m supposed to know and memorise where and when a keyboard command is safe to use. I wouldn’t want to accidentally do a reboot on a system that’s vital to keep online, so I would like to remind myself here and now, that being safe and secure always requires me to think twice before doing anything. Own system = do whatever you want and press your favourite keys. Borrowed system = just use basic commands such as Ctrl+C and Ctrl+V for copy-paste, and use the mouse if you can to slow me down. No job, except hacking in warzones and saving people from burning buildings can be that critical and important that I have to use super fast keyboard commands… right? (Hmm, so keyboard commands are just for my own pleasure!)

On a side-note, I noticed the same happening with mouse gestures for those occasions I actually use the mouse ;) I mainly use the back/forward/close document gestures in Opera and Firefox (easily obtained from https://addons.mozilla.org/en-US/firefox/addon/39). Whenever I use Internet Explorer, I get frustrated for not having gestures there too.

Back to keyboard shortcuts! Today I was browsing my immensely vast collection (no exaggeration here!) collection of photos. From old old habits of some windows software I had, I prefer to hit right and left arrow key instead of space and backspace for browsing to the next and previous image. Depending on the image viewing software, these arrow keys do something else. This time I was using Gwenview on a folder, cause I had just JPEG images. Whenever I press right/left it rotates the image, which totally made me angry.

When you accidentally have rotated an image and then remember to press space, it always pops up a dialogue asking me if I want to save the image changes. I can select “Yes”, “No” and I can also check the a box “Don’t show this dialogue” anymore. I always press NO, because I am viewing images. I don’t ever want to modify my original images. Besides, I don’t trust what it would do to my image. Will it use an internal algoritm, mogrify or jpegtran? Will it preserve EXIF data, will it preserve original modification timestamp for the file? Is there a backup of the original, can I undo the changes? Is it really my job to figure all of this out with this simple Yes / No” dialogue? And what if I actually check the box… where does it store my setting, how can I undo it? If I have the setting saved, will it automatically answer yes or no in the future. Will my image viewer be rendered useless after that? So what do I do, besides get angry? I read the manual. Pressing F1 opens up the Gwenview User Manual. 4 chapters in total.

Revision 1.2.92 (2005-08-21)
Copyright © 2005 Aurélien Gâteau

Table of Contents
1. Introduction
    What is Gwenview
2. The interface
    Browse and View modes
3. External tools
4. Tips
    Using the mouse
    Panning with the mouse
    Zooming with the mouse
    Browsing with the mouse
    Key bindings
    Docked windows

The manual is from 2005?! You have to be kidding me!! This made me even more angry. In fact, angry to the point that I downloaded the source code by issuing the command

apt-get source gwenview

Then I started examining the source code for the application to see what it did if I rotated the image. It seems to rotate the image just in memory, set a bool mModified to contain true. After a bit of investigation, in the file src/gvcore/document.cpp I disabled the function saveBeforeClosing to do nothing, even if the file has been “modified”.

void Document::saveBeforeClosing( ) {
   d->mModified=false;
   return;
}

To test my changes, I just needed to recompile the sources. I just recently learned from my friends how to do it the right way in a distribution specific way. Instead of running make && make install, you are supposed to create an installation package with a simple dpkg-buildpackage in the source code root. After that you can just issue dpkg -i on the generated .deb file.

Compilation took a few long minutes but after installation of my custom package, it now stopped asking me about saving my changes. And that’s how I made my image viewer to be less annoying. Of course, I’ve now also changed keyboard shortcuts inside Settings –> Configure Shortcuts to customise my keyboard shortcuts to something that suits me better. Now I have left and right for browse previous and next and Alt+left and Alt+right for rotating the image.

Just don’t let me use your KDE system, I might accidentally destroy your original image files, if your system behaves in the standard, or even worse, in some other custom fashion!

What do we learn from all of this?

Windows is good. Linux is too good.

Now I just need to find a way to disable automatic rotation of the thumbnails and images from the EXIF orientation tag. Some might like it, but it’s slow on my system and I really need to see which images aren’t correctly rotated. Already found the file miscconfig.kcfg, only thing that remains is to understand how it works. Hmm.. Seems to address just the two issues I have with the browser! Don’t ask me about saving and don’t rotate images.

Back to the Configuration dialogue… aha! It took me the source code not to become blind to the obvious settings! How blind can one get? Back away professionalism, I couldn’t even see the forest for the trees.

I don’t feel stupid for wasting my time trying to hack into the code to solve a trivial problem, not at all. Now I am actually learning how to modify KDE applications for my system, which will undoubtedly come in handy in the future when I plan to submit patches to the official Kubuntu repository :)

Read more about keyboard bindings on KDE here http://www.linux.com/feature/54468

Gallery broken!

0 Comments | This entry was posted on Aug 21 2008
Slow turtle

Slow turtle

Oh no, there is some database error in my photo exhibition, and all galleries are not shown correctly. I am working on fixing it, sorry for the inconvenience all!
I will try to get it fixed on Sunday. On Saturday I have my sister’s birthday party to attend to.

Edit: So, after a bit of investigation I concluded that there wasn’t an error in the database, but I was merely experiencing a side-effect of being a bit careless.

I suspect a folder got password protected when I edited its name and properties. Firefox 3 has this silly habit of pre-entering passwords into fields, a wrong one in this case, and I missed to clear the password before hitting that save button. Really annoying to say the least. Maybe I should complain to the Mozilla developers about how the password cache works badly, or perhaps I could modify the Photo Exhibition software to use different names for password fields (for login and album properties). That might prevent passwords for getting mixed up liket that.

My website has a forum, webmail, sql administration panel etc. all with different passwords, but somehow Firefox still can’t get it right. Never had the same problem with Opera, by the way. Even Internet Explorer seems to do a much better job at it!

30 today

0 Comments | This entry was posted on Aug 17 2008

Happy birthday to me!

Å Festen

2 Comments | This entry was posted on Aug 15 2008

Yehaaw! Party’s on, and of course I will be there. I’ll be uploading photos later on Monday. If you spot yourself on a picture, please comment! =)

Foton från Eskilstuna Å Festen 2008 kommer up nu senare på Måndag, när jag hinner gå igenom bilderna som blev bra.