Archive

Posts Tagged ‘Open Souce’

About Krita and Gimp, in default installation

26 November, 2009 16 comments

The removal of GIMP from the default installation of Ubuntu has raised quiet a stir. And as drawn quiet a bit of advertisement for Krita, as some people suggested the use of Krita instead, but for no good reasons, since Krita is not a good replacement for GIMP as a default installation.

You have to consider the use case of the default installation, since the Ubuntu people are trying to make is a distribution that is usefull for the average users, the default installation need to cover the need of the many. And what most people want to do with their picture is to classify them, do light weight retouching (for instance, adjust the brightness, remove red eyes) and then print the image or send it on the Internet. Surely, both Krita and GIMP can do it, but they have way more features than what is needed for most users. As Sven Neumann, one of the core GIMP developer, said GIMP is a high-end application for professionals, and so is Krita. Some might think that Krita has a GUI that is more friendly to the beginner, but that is not the problem, it is still packed with features that are of no interest to most users. And there are tools that are better suited to accomplish the task of those users, this is why a pictures collection management tool, such as F-Spot or Digikam is a much better choice, it covers the main usage of the majority of users. Even if Digikam is designed for professional photographer, I still think it scale nicely to average users. And when the user want to do more with images, he can just go to his favorite package manager, and install GIMP or Krita.

Advertisements

OpenGTL 0.9.12 and Shiva noise

20 November, 2009 Leave a comment

OpenGTL 0.9.12

Earlier today I made a new release of OpenGTL (download page), version 0.9.12, for that release 23 tasks were completed, the main changes are:

  • Fixing thread safety issues at run time.
  • Progress report.
  • Many new mathematical functions for the Shiva standard library.
  • Replacement of the Shiva kernels random functions.
  • OpenGTL is now compiling and running on Mac OS X.

The first two points are important changes for krita, since the first one meant that with the previous releases we had to use mutex while executing Kernels, preventing to benefit from multi-core. The second one means the user can see something is happening in Krita when a filter is processed.

Random functions in Shiva

This new release also break the Shiva language compared to previous release, I try to prevent that, but since the language is still very young it was bound to happen. In previous releases I quickly introduced a rand() function, because I wanted to write a perlin noise generator. The problem with rand() is that it does not take a seed parameter, meaning that the function use the global seed, meaning that two consecutive call to ther perlin noise generator kernel gives two different results, without any kind of control. For graphics, we need to make sure that the result are reproductible, so now in 0.9.12, the function rand() has been replace by one that takes a seed parameter rand(output int seed).

Such a function is usefull at init time, to construct random structures, like those needed by the perlin noise. But this is not sufficient, we also need a random function that can be used while processing a pixel, and one that would always return the same value for a given pixel and a given seed, for instance to write a salt and pepper noise generator.

The problem of the rand(output int seed) function is that it works by incrementing the seed parameter, so that next time you call it, it gives a different result, so as long as the call are made sequentially it would work fine. But in case of Shiva (or Krita, for that matter), we cannot guarantee that those call will be made sequentially, and it is not possible to keep a value between the computation of two different pixels. Because we might just be interested in generating part of the image, or we might be executing the kernel in a multi-threaded environment. To solve this problem, about six monthes ago, in Krita, we developed an algorithm that takes the pixel coordinate and the seed, and return a pseudo-random number. For 0.9.12, I copied that algorithm in Shiva, giving birth to the second new function for random number generation, which is rand(int x, int y, int seed).

The code for the salt and pepper noise generator is:

kernel Noise
{
  void evaluatePixel(out pixel4 result)
  {
    int x = result.coord.x;
    int y = result.coord.y;
    for(int i = 0; i < 3; ++i)
    {
      result[i] = frand(x, y, 32);
    }
    result.setAlpha( 1.0);
  }
}

The code for the perlin noise generator is slightly more complicated and can be watch in the opengtl mercurial repository.

And the resulting images, salt and pepper noise on the left, and perlin noise on the right: