lense distortion plugin
This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
color balance (preserve luminosity) bug
I found a bug in Gimp's preserve luminosity feature located in the color balance tool (code is in color-balance.c).
The easiest way to see the bug is to turn on preserve luminosity and adjust R G B to any amount that is equal. The result should be no change to the image at all because they should cancel each other out and the brightness should stay the same due to PL.
Any ideas on why the current PL feature isn't working correctly. At a first glance the code method for doing this looks ok... I'm not sure about the function "gimp_rgb_to_l_int" however. Specifically, I'm not sure if this is the correct formula to find the lightness. Why would it not be:
L = (R + G + B) / 3
I tried making this change, but it looks even worse. This code chunk might not be the issue, but it's the first thing that jumped out at me. Any suggestions?
- Sean
==================
snip from color-balance.c
==================
/**
* gimp_rgb_to_l_int:
* @red: Red channel
* @green: Green channel
* @blue: Blue channel
*
* Calculates the lightness value of an RGB triplet with the formula
* L = (max(R, G, B) + min (R, G, B)) / 2
*
* Return value: Luminance vaue corresponding to the input RGB value
**/
int
gimp_rgb_to_l_int (int red,
int green,
int blue)
{
int min, max;
if (red > green)
{
max = MAX (red, blue);
min = MIN (green, blue);
}
else
{
max = MAX (green, blue);
min = MIN (red, blue);
}
return ROUND ((max + min) / 2.0); }
color balance (preserve luminosity) bug
example images of bug manifestation
color balance (preserve luminosity) bug
--- sean wrote:
Why would it not be:
L = (R + G + B) / 3
Because 255 blue is dimmer than 255 green. NTSC standard: Gray scale intensity = 0.299R + 0.587G + 0.114B
___
color balance (preserve luminosity) bug
I'm not working on directly with the Gimp source, but I did fix the bug with Preserve Luminosity. The offending code in color-balance.c lines 182-187:
if (cb->preserve_luminosity)
{
gimp_rgb_to_hsl_int (&r_n, &g_n, &b_n);
b_n = gimp_rgb_to_l_int (r, g, b);
gimp_hsl_to_rgb_int (&r_n, &g_n, &b_n);
}
I'm working in Objective-C, so my code isn't copy paste ready. Basically, if cb-> preserve_luminosity, re-scale the slider values so that the lightness of R1+G1+B1 = the lightness of the base pixel R+G+B, now use these modified slider values when changing the pixel values:
-(NSBitmapImageRep *)colorAdjustedImage:(NSBitmapImageRep *)baseImageRep
preserveLumenance:(BOOL)preserveLumenance
colorTone:(LSColorTone)colorTone
{
int w,h,x,y = 0;
unsigned char *srcData, *p1;
int n, red, green, blue;
double shadowScale, midScale, highlightScale;
shadowScale = midScale = highlightScale = 1.0;
if (preserveLumenance == YES) {
shadowScale = 1.0 / ( ([_shadowToneRed doubleValue] / 100.0) +
([_shadowToneGreen doubleValue] / 100.0) + ([_shadowToneBlue
doubleValue] / 100.0) );
midScale = 1.0 / ( ( [_midToneRed doubleValue] / 100.0) + (
[_midToneGreen doubleValue] / 100.0) + ( [_midToneBlue doubleValue]
/ 100.0) );
highlightScale = 1.0 / ( ( [_highToneRed doubleValue] / 100.0) + (
[_highToneGreen doubleValue] / 100.0) + ( [_highToneBlue doubleValue]
/ 100.0) );
shadowScale = shadowScale < -1/3 ? -1/3 : shadowScale;
shadowScale = shadowScale > 1/3 ? 1/3 : shadowScale;
shadowScale = shadowScale == 0 ? 1.0 : shadowScale;
midScale = midScale < -1/3 ? -1/3 : midScale; midScale = midScale > 1/3 ? 1/3 : midScale; midScale = midScale == 0 ? 1.0 : midScale;
highlightScale = highlightScale < -1/3 ? -1/3 : highlightScale;
highlightScale = highlightScale > 1/3 ? 1/3 : highlightScale;
highlightScale = highlightScale == 0 ? 1.0 : highlightScale;
}
// update the tonal range values from any changes in the UI
[self applyToneToColorAdjustment:colorToneMatrix];
// now set the slider values for the different tonal ranges
cyan_red[LSColorToneShadow] = shadowScale * [_shadowToneRed
doubleValue];
magenta_green[LSColorToneShadow] = shadowScale * [_shadowToneGreen
doubleValue];
yellow_blue[LSColorToneShadow] = shadowScale * [_shadowToneBlue
doubleValue];
cyan_red[LSColorToneMidtone] = midScale * [_midToneRed doubleValue]; magenta_green[LSColorToneMidtone] = midScale * [_midToneGreen doubleValue]; yellow_blue[LSColorToneMidtone] = midScale * [_midToneBlue doubleValue];
cyan_red[LSColorToneHighlights] = highlightScale *
[_highToneRed doubleValue];
magenta_green[LSColorToneHighlights] = highlightScale *
[_highToneGreen doubleValue];
yellow_blue[LSColorToneHighlights] = highlightScale *
[_highToneBlue doubleValue];
// create the color lookup tables for the current slider values
and tonal ranges
[self color_balance_create_lookup_tables];
// change the pixels
w = [baseImageRep pixelsWide];
h = [baseImageRep pixelsHigh];
srcData = [baseImageRep bitmapData]; n = [baseImageRep bitsPerPixel] / 8;
for ( y = 0 ; y < h ; y++) {
for ( x = 0 ; x < w ; x++) {
int r, g, b = 0;
p1 = srcData + n * (y * w + x);
// get the pixels color components
r = p1[0];
g = p1[1];
b = p1[2];
// lookup the new color values in the LUTS contructed from
slider values and tonal selections
red = r_lookup[r];
green = g_lookup[g];
blue = b_lookup[b];
// preserve lumenance if requested to do so
// original code from adapted from the Gimp, which does not work correctly.
// if (preserveLumenance == YES) {
// gimp_rgb_to_hsl_int (&red, &green, &blue); // red
becomes hue, green becomes saturation, blue becomes lightness
// blue = gimp_rgb_to_l_int (r, g, b); // get the
lightness, set it
// gimp_hsl_to_rgb_int (&red, &green, &blue);
// }
// stomp the pixel component values
p1[0] = red;
p1[1] = green;
p1[2] = blue;
}
}
return baseImageRep; }
color balance (preserve luminosity) bug
On 12/14/05, Jon Niehof wrote:
--- sean wrote:
Why would it not be:
L = (R + G + B) / 3
Because 255 blue is dimmer than 255 green. NTSC standard: Gray scale intensity = 0.299R + 0.587G + 0.114B
True, although unless you are coding for a 1960's color television, it's probably better to use the sRGB/ITU-R 709 formula: Y = 0.2126R + 0.7152G + 0.0722B.
If you're really interested, the finer points of color are explained at http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html
Rockwalrus
Rockwalrus
lense distortion plugin
Hi, have been using daves lense distortion plugin. it realy usefull for making tiled textures and seems a good plugin to include for any app that works with photos.
http://members.ozemail.com.au/~hodsond/gimp.html It compiles with Gimp CVS also.
- Cam
lense distortion plugin
On 12/20/05, Campbell Barton wrote:
Hi, have been using daves lense distortion plugin. it realy usefull for making tiled textures and seems a good plugin to include for any app that works with photos.
http://members.ozemail.com.au/~hodsond/gimp.html It compiles with Gimp CVS also.
avp@traveller:~/soft/build/graphics/gimp-plugins$ gimptool-2.0
--install wideangle.c
/usr/bin/install -c -d /home/avp/.gimp-2.3/plug-ins
gcc -g -O2 -Wall -I/usr/include/gimp-2.0 -I/usr/include/gtk-2.0
-I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo
-I/usr/include/pango-1.0 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -o /home/avp/.gimp-2.3/plug-ins/wideangle
wideangle.c -L/usr/lib -lgimpui-2.0 -lgimpwidgets-2.0 -lgimp-2.0
-lgimpcolor-2.0 -lgimpmath-2.0 -lgimpbase-2.0 -lgtk-x11-2.0
-lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0
-lfontconfig -lXinerama -lXi -lXrandr -lXext -lXcursor -lXfixes
-lpango-1.0 -lcairo -lXrender -lX11 -lgobject-2.0 -lgmodule-2.0 -ldl
-lglib-2.0
wideangle.c: In function 'readPresetFile':
wideangle.c:953: warning: pointer targets in assignment differ in signedness
wideangle.c:954: warning: pointer targets in passing argument 1 of
'fopen' differ in signedness
wideangle.c:964: warning: pointer targets in passing argument 1 of
'addPreset' differ in signedness
wideangle.c: In function 'writePresetFile':
wideangle.c:978: warning: pointer targets in assignment differ in signedness
wideangle.c:979: warning: pointer targets in passing argument 1 of
'mkdir' differ in signedness
wideangle.c:984: warning: pointer targets in assignment differ in signedness
wideangle.c:985: warning: pointer targets in passing argument 1 of
'fopen' differ in signedness
wideangle.c: In function 'wideangleDialog':
wideangle.c:1073: warning: missing sentinel in function call
Huh? :)
Alexandre
lense distortion plugin
Alexandre Prokoudine wrote:
wideangle.c: In function 'readPresetFile': wideangle.c:953: warning: pointer targets in assignment differ in signedness wideangle.c:954: warning: pointer targets in passing argument 1 of 'fopen' differ in signedness
[...] etc.
I haven't seen those before - what version of gcc are you running? In any case, they're just warnings, so it should still compile and install.
lense distortion plugin
On 12/20/05, David Hodson wrote:
I haven't seen those before - what version of gcc are you running?
4.0.1
In any case, they're just warnings, so it should still compile and install.
It doesn't. Could we possibly move this discussion to some other mailing list?
As for your original mail, did you meanincluding this plug-ins into the bundle? If so, I don't think it's possible. Developers will rather strip plug-ins than add more.
Alexandre
lense distortion plugin
Yep, was suggesting that it be included since 95% of users wont go and install plugins even if they'd use them. About not adding new plugins...
Im not sure how the Gimp people work but if your more interested in
stripping plugins-
Take a look and
Distort>Blinds,
Artistic>Preditor
Light and Shadow> Apply Lense
... All seem like theyd have significantly less procticle application
then - Removing lense distortion.
Alexandre Prokoudine wrote:
On 12/20/05, David Hodson wrote:
I haven't seen those before - what version of gcc are you running?
4.0.1
In any case, they're just warnings, so it should still compile and install.
It doesn't. Could we possibly move this discussion to some other mailing list?
As for your original mail, did you meanincluding this plug-ins into the bundle? If so, I don't think it's possible. Developers will rather strip plug-ins than add more.
Alexandre _______________________________________________ Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
color balance (preserve luminosity) bug
example images of too much cleaveage for a mailing list kthx. there are women on this list too....
sean wrote:
example images of bug manifestation
color balance (preserve luminosity) bug
On 12/21/05, miriam clinton (iriXx) wrote:
example images of too much cleaveage for a mailing list kthx. there are women on this list too....
This is just photogtaphy, not even nu. Nothing "too much", really
Alexandre
color balance (preserve luminosity) bug
On Wed, Dec 14, 2005 at 11:05:46AM -0800, sean wrote:
example images of bug manifestation
could you put these images online? we don't mail images on this list.
thanks,
carol
color balance (preserve luminosity) bug
There is free speech; and then there is tact and manners.
Playboy centrefolds on a devel list are not what I call manners, nor do I consider that ironic, given my tag line. A man may certainly say what he likes - but manners maketh the man.
QED?
mC~
Tim Jedlicka wrote:
Sorry OT - but...perhaps you should change your tag line if you are easily offended. I suspect Voltaire would approve, and if not, I doubt he would object. Not disagreeing (nor agreeing) with your comment, simply pionting out the irony of your tag line.
On 12/20/05, *miriam clinton (iriXx)* > wrote:
example images of too much cleaveage for a mailing list kthx. there are
women on this list too....
--
"I disapprove of what you say,
but I will defend to the death your right to say it." -Voltaire------------------------------------------------------------------------
No virus found in this incoming message. Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.1/207 - Release Date: 19/12/2005
color balance (preserve luminosity) bug
Alexandre Prokoudine wrote:
On 12/21/05, miriam clinton (iriXx) wrote:
example images of too much cleaveage for a mailing list kthx. there are women on this list too....
This is just photogtaphy, not even nu. Nothing "too much", really
That does not mean that it is pleasant to have to look at.
If you want to get your kicks out of pornography, kindly keep it to your bedroom. Consider the other participants on this list - I know I am not the only woman here.
I could give you several other reasons why 'not even nu' photography is damaging to both men and women in society and to a woman's self-image. But this is not the place for an essay on anorexia nervosa and the moral decay of society.
mC~
color balance (preserve luminosity) bug
I'm sorry Miriam, but claiming those photos were anything even remotely close to Playboy centerfolds is simply a drastic distortion. Those photos were tastefully done, and are certainly *much* less revealing than many of the photos on the cover of Cosmo' and such that are sitting at every grocery store checkout counter. No portions of the woman's breasts or any other private parts were revealed, nor were the clothes at all see-through, nor did they particularly show revealing contours of anything underneath. Yes, the V cut is a little low, but it doesn't show *anything*. It seems to me that you are being *way* overly sensitive.
s/KAM
----- Original Message ---
color balance (preserve luminosity) bug
On Thu, Dec 22, 2005 at 10:45:56AM +1100, miriam clinton (iriXx) wrote:
Alexandre Prokoudine wrote:
On 12/21/05, miriam clinton (iriXx) wrote:
example images of too much cleaveage for a mailing list kthx. there are women on this list too....
This is just photogtaphy, not even nu. Nothing "too much", really
That does not mean that it is pleasant to have to look at.
If you want to get your kicks out of pornography, kindly keep it to your bedroom. Consider the other participants on this list - I know I am not the only woman here.
I could give you several other reasons why 'not even nu' photography is damaging to both men and women in society and to a woman's self-image. But this is not the place for an essay on anorexia nervosa and the moral decay of society.
Oh please. The images in question are so not pornography. You could see people dressed like that in G rated Disney films.
This is a mailing list about GIMP development. GIMP is about all sorts of images. Prudish lectures about images have nothing to do with GIMP development. If that's all you can contribute, you don't really belong on this list.
As far as I'm concerned, even images with nudity are fine here, so long as there's some artistic merit. Giving URLs to images instead of attaching them is preferred however.
This is the final word on this subject. I don't want to see any more posts from you, Miriam, regarding this.
-Yosh
color balance (preserve luminosity) bug
On 12/22/05, miriam clinton (iriXx) wrote:
This is just photogtaphy, not even nu. Nothing "too much", really
That does not mean that it is pleasant to have to look at.
If you want to get your kicks out of pornography, kindly keep it to your bedroom. Consider the other participants on this list - I know I am not the only woman here.
I could give you several other reasons why 'not even nu' photography is damaging to both men and women in society and to a woman's self-image. But this is not the place for an essay on anorexia nervosa and the moral decay of society.
Miriam, I'm not in a mood to argue about thresholds of sensitivity, especially when it comes to portrait photography.
If you are not the only woman in this list, then I'd like to hear from others, possibly offlist, because I would like to encourage development of GIMP, not development of flamewars. Until then I will have to live with the fact that you are trying to talk for people who haven't granted you the right to do so ;)
Alexandre
lense distortion plugin
Hi,
Campbell Barton writes:
Yep, was suggesting that it be included since 95% of users wont go and install plugins even if they'd use them.
Agreed. Please file an enhancement request for this issue at our bug-tracker on bugzilla.gnome.org. Thanks.
Sven