[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    Re: trouble with the scale bug
From:       Casper Boemann <cbr () boemann ! dk>
Date:       2007-05-25 15:08:08
Message-ID: 200705251708.08373.cbr () boemann ! dk
[Download RAW message or body]

On Friday 25 May 2007 16:54, Matthew Woehlke wrote:
> Casper Boemann wrote:
> > And as these transparent borders are mathmatically correct (eventhough
> > for a plain rect picture not attractive) I feel that we should come up
> > with something similar to what photosop does.
>
> To ask a "dumb" question, /why/ are they "mathematically correct"? It
> seems it should be possible to define the resize algorithm in a way that
> avoids this problem...

Well because the "new pixel" is sampled from the pixels it cover in the old 
image.

If half of the pixels it cover are transparent then the result shoul be 
transparent too.

Otherwise scaling irregular shaped images would provide jagged edges.

The questions is not as dumb though, since what you are asking for is an 
algorithm that automatically preserves hard edges and blurs in other places. 
Such algorithms do exist, but is a bit out of reach for us just yet.

Anyway I've commited a fix that resets the transparency of border pixels after 
the scaling is done. This way I calculate the correct color (without 
overrepresenting the border color). I also do the little trick of setting the 
transparency to that of the nearest pixel in the original image. That way I 
also preserve the transparency of the original transparency.
-- 
best regards / venlig hilsen
Casper Boemann
_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic