As many of you might have noticed Nokia has started to publish Maemo 6 components (code name Harmattan) in Gitorious. The biggest thing is of course the Maemo 6 UI Framework but Nokia has also published Maemo Image Editor - libraries for image loading, writing, manipulation (edit filters) and for thumbnailing. Repositories for MaemoUI framework and for Image Editor can be cloned from Gitorious. See the links below:
Maemo 6 UI Framework:
Maemo Image Editor:
My purpose in this post is to go through little bit the Maemo Image Editor components so that you should get an overall picture what is there and what it can be used for. I don’t go into the details very deeply. Keep in mind that libquill is just released so I guess what I write here is not the final and there can also be errors this post. Please let me know if you disagree what I tell here. Btw, libquill is already being used for thumnailing in tumbler. Let’s start with the Maemo image editor. I will post another blog entry for the Maemo 6 UI Framework later.
Maemo Image Editor aka libquill
Despite of the name “Image Editor” this repository doesn’t provide the actual editor application, but only a demo application in a different repository. The demo application can be used as a reference application if you decide to start to use the libquill. The Image Editor is based on Qt so it provides nice interface via Qt signals and slots mechanism. For example when an image is available (loaded by QuillFile) there is a signal for that or when an error occurs there is a error signal for that and also when an image is removed there is a signal for that and so on. In my opinion, as an “old” Qt developer, I like this kind of approach. Image Editor takes advantage of Qt quite well, I’m meaning with this that there are many Quill classes that inherit from Qt classes. For Qt developers there is a prf file included in the package, meaning that you can start to use libquill just adding the following line in your application’s pro file: CONFIG += quill. For pkg-config there is a pc file included.
The Image Editor can be divided in two different parts: libquill and quillimagefilters
The first part , libquill provides a singleton class Quill for accessing resources that Quill provides such as setting preview and cache sizes for different display levels. The display level here means that you can define several different display levels for a a single image. The first level (0) can be like a smallest image size that application want to display, the second level can be like twice as large as the first one and so on. With this approach application can speed up image loading and while it has loaded the first preview level image, it can do it tricks in the background. Quill also provides a QuillFile class which can be used for reading, writing, deleting an image on a disk. Quill provides undo and history information. With a “history”, I mean the history of the actions that are made to the image. There is unlimited undo and image loading is done in the background so it should not block the calling application.
Couple words about caching. The caching is complex thing (and I don’t fully understand how it works in this context) but keep in mind when you are using Quill for managing several files. There is a cache limit for setting how many files can be open at once. So it is up to the user of the Quill to remember to release QuillFiles. Releasing a QuillFile is as simple as setting the display level to -1 for that specific QuillFile instance. After that Quill will take care of cleaning everything. There are also other caches for Quill like edit history cache and tile cache. Please take a look at the documentation for further details.
One very important thing that Quill provides is a recovery from crashes. It is possible to get back to the state that was for example before the application crashed.
The second part, quillimagefilters provides filters for image manipulation. This module provides a framework to introduce new filters by using Qt’s QtImageFilterFactory. The new filter must be registered to the system, but I don’t go to the more details here. The point is to make you aware that it is possible to extend the current set of filters. At the time of writing this there were filter classes for:
- brightness and contrast
- color balance
- free rotation
- red eye reduction.
Library libquillimagefilters provides a class QuillImage which extends Qt’s QImage by inheriting it. The class QuillImage is always the entry point for doing image manipulation operations to the images. All the filters implement the same interface class QuillImageFilter which inherits the QtImageFilter. Filters also accept a plain QImage as an image, but it requires extra information to use that so the preferred way is to apply filter to QuillImage instance.
How these two libraries are bound together then? Basically it depends on what you want to do with these libraries. Here is a short list of what you can do with the libquill then.
- You can set different amount of display levels (0,1,2,..N) for thumbnails and for full size images and for something between these two.
- Yes, you can use libquill for thumbnailing
- You can use libquill for image editing. Get QuillFile and apply a filter to it.
- You can always undo back to the orgininal file even after your application has closed or crashed
- You can use the same instance of QuillFile to access different display level images.
- Modifying QuillImage using filters makes QuillFile instance to notify changes e.g. making changes to the image at display level 5 makes the image change at display level 0. This way you can have one handle to the same instance and you will be notified. Same rule applies when the image is being deleted.
As a summary I can say that using Maemo Image Editor can be a worth to try. It’s under development according gitorious logs and according to Alexander Bokovoy’s lecture in Maemo Summit 2009. They have a plan, that it should be able to support images up to 100Mpix size in mobile-like-environments. Let’s see what happens. I hope that you have found this article useful. Please comment if you feel so. That’s all folks.