Bug 137552 - Brightness-contrast filter doesn't filter white pixels
Summary: Brightness-contrast filter doesn't filter white pixels
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Filters (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Camilla Boemann
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-18 22:25 UTC by Vsevolod Krishchenko
Modified: 2007-12-06 14:38 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
krita image + adj layer (92.21 KB, application/x-krita)
2006-11-19 09:48 UTC, Halla Rempt
Details
Sample for white points problem (12.23 KB, application/octet-stream)
2006-11-19 11:45 UTC, Vsevolod Krishchenko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vsevolod Krishchenko 2006-11-18 22:25:28 UTC
Version:           1.6.0 (using KDE 3.5.5, Kubuntu (edgy) 4:3.5.5-0ubuntu3)
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.17-10-386

I tried Krita with small RGB/8 image (640x480) with Brightness/Contrast (curves) adjustment layer and found some problems.

1. After saving and then loading file, adj. layer does not affect image at all. New adj. layer work fine - but only until document saved and loaded again.

2. Adj. layer (curves) does not work on pixel with (255,255,255). Such pixels remains white with any curve, even with curve y=0.
Pixel 250,250,250 and whiter affected with this bug too but in stranger way. Just paint black-white gradinat in image layer and then try adjut. layer on it and you'll see.
 
3. I cannot paint on adjustment layer with any tool. I'm sorry if this is uncomplete feature and nota a bug.

BTW, I'm gonna test svn version now.
Comment 1 Halla Rempt 2006-11-19 09:47:28 UTC
I cannot confirm. Could you try loading the attached image and see whether that one doesn't work for you either?
Comment 2 Halla Rempt 2006-11-19 09:48:20 UTC
Created attachment 18608 [details]
krita image + adj layer
Comment 3 Vsevolod Krishchenko 2006-11-19 11:45:37 UTC
Created attachment 18611 [details]
Sample for white points problem

Adjustment layer does not work correctly for white pixels.
Comment 4 Vsevolod Krishchenko 2006-11-19 11:46:31 UTC
On 19 Nov 2006 08:47:32 -0000
 boud@valdyas.org wrote:
> I cannot confirm. Could you try loading the attached
> image and see whether that one doesn't work for you
> either?


Yes, adjustement layer does not affect this image (removing
or hiding adj. layers does not change visible image).

And I cannot draw on adj. layer too.

Sample image does not have white point (255,255,255) and
the adj. layer translate white point into itself, so I
cannot check whiote point problem on it :)

I attached my sample with white pixels.
 
Comment 5 Halla Rempt 2006-11-19 13:21:47 UTC
Casper, could you look into the workin gof the brightness/contrast filter on white pixels?
Comment 6 Halla Rempt 2006-11-19 14:17:08 UTC
Hiding/showing the adjustment layer in my sample does make a visual difference 
for me; same with your example -- although indeed it looks as if the white 
pixels are not affected. The same happens when I apply the filter directly to 
a white image, so that has nothing to do with adjustment layers, but it is 
something that needs to be looked into. I'll assign this problem (white 
pixels are not darkened by brightness/adj filter) to Casper who created the 
filter. The problem with adj layers working or not is a worksforme with Krita 
1.6.1 (which is now being tested for release). Could you checkout and compile 
the 1.6 branch of KOffice and see if it works for you?
Comment 7 Vsevolod Krishchenko 2006-11-19 19:24:29 UTC
On 19 Nov 2006 13:17:09 -0000
>  2006-11-19 14:17 -------
> Hiding/showing the adjustment layer in my sample does
> make a visual difference  for me; 

This not the case for my computer :(
I believe it should be specific Kubuntu 6.10 bug. 
If I remember correcly, it was fine on 6.06 and koffice
1.6.0. I will use SVN version next time.

> looks as if the white 
> pixels are not affected. The same happens when I apply
> the filter directly to 
> a white image, so that has nothing to do with adjustment
> layers, but it is 
> something that needs to be looked into. 

Yes, it is very serious problem.

> Could you
> checkout and compile 
> the 1.6 branch of KOffice and see if it works for you?

I working on it all day long. I just complied, at least.
I'll check it as soon as possible.
Comment 8 Vsevolod Krishchenko 2006-11-20 09:51:00 UTC
On Mon, 20 Nov 2006 11:47:33 +0300

> filter. The problem with adj layers working or not is a
> worksforme with Krita 
> 1.6.1 (which is now being tested for release). Could you
> checkout and compile 
> the 1.6 branch of KOffice and see if it works for you?

  I have compiled koffice from svn and gonna test it today.
As I thought, the problem with "invisible" adj. layer
dissappears, but it looks like some new problems are on the
way :) 
  
Comment 9 Vsevolod Krishchenko 2006-11-20 21:29:26 UTC
On Mon, 20 Nov 2006 11:47:33 +0300
 <boud@valdyas.org> wrote:

> Hiding/showing the adjustment layer in my sample does
> make a visual difference for me; 

I just test it for a while and found this problem again.
I load and saved some files in krita about twenty times,
and from some unhappy moment adjustement layers did not
change any freshly loaded images exactly as I said! The
strangest thing is closing all instance of krita did not
solve this problem (reboot did). I still cannot show the
way how to reproduce the problem I did but I try reproduce
this again. :(

BTW, did I understood correctly that any non-erase tool
always made adj. layer "opaque" and any erase/clear tool
make it transparent? It is a pity that I cannot paint a
gradient on adj. layer :( Should I post it to wishlist or
buglist?
Comment 10 Halla Rempt 2006-12-29 16:04:30 UTC
Gradients on an adjustment layer should work, as do partially opaque painting (with the opacity set to something else than 50%). For painting on masks, you need to vary the gray level of the color. Weird, I know, but we managed to miscommunicate between two developers.

About the real problem: I'm still baffled :-(.
Comment 11 Halla Rempt 2006-12-30 16:34:08 UTC
Maybe better summary: the b-c filter doesn't filter white pixels, or so it seems.
Comment 12 Halla Rempt 2006-12-30 16:44:58 UTC
Doesn't work with lcms 1.16 either -- I guess we're doing something wrong here?
Comment 13 Camilla Boemann 2007-01-09 12:03:06 UTC
Seems to be a bug in lcms

I'll investigate further and send them a bug report
Comment 14 Halla Rempt 2007-01-11 10:22:32 UTC
It's a feature, but one we'll be able to fix: 

From:  "Marti Maria" <marti.maria@littlecms.com>

That's not a bug, that's a feature. :-)

Some (broken) profiles does not map pure white to pure white, and this may cause "scum dot" which is small, disperse dots on the printout. Please note that ICC spec *requires* white to be mapped on white. Lcms silently fixes those broken profiles. Unfortunately, that may affect to your case, too. Just use cmsFLAGS_NOWHITEONWHITEFIXUP on the flags field of cmsCreateMultiprofileTransform, and make sure to upgrade to 1.16.

Regards
Marti.

-----Original Message-----
From: lcms-user-bounces@lists.sourceforge.net [mailto:lcms-user-bounces@lists.sourceforge.net] On Behalf Of Boudewijn Rempt
Sent: Thursday, January 11, 2007 9:39 AM
To: lcms-user@lists.sourceforge.net
Cc: Boemann, Casper
Subject: [Lcms-user] Problem with modifying the lightness of white pixels with lcms?

Hi,

Casper, one of the Krita hackers asked me to ask the about following:

---

After having used lcms to do some lightness transformation using the following code I've come across a problem.

My code tries to convert from a working colorspace to lab and back. But whil in lab it modifies the L* channel with the use of a transfer table.

The trouble is that white pixels are not touched. Even if I set the transform / gamme table to all zero the white pixels remain white. 

Am I doing something wrong or is there a bug in lcms:

    LPGAMMATABLE transferFunctions[3];
    transferFunctions[0] = cmsBuildGamma(256, 1.0);
    transferFunctions[1] = cmsBuildGamma(256, 1.0);
    transferFunctions[2] = cmsBuildGamma(256, 1.0);

    for(int i =0; i < 256; i++)
        transferFunctions[0]->GammaTable[i] = transferValues[i];

    profiles[1] = cmsCreateLinearizationDeviceLink(icSigLabData,
                                              transferFunctions);
    cmsSetDeviceClass(profiles[1], icSigAbstractClass);

    profiles[0] = m_profile->profile();
    profiles[2] = m_profile->profile();
    
    transform  = cmsCreateMultiprofileTransform(adj->profiles, 3, m_cmType,
                    m_cmType, INTENT_PERCEPTUAL, 0);

    cmsDoTransform(transform, src, dst, nPixels);
---
Comment 15 Halla Rempt 2007-12-06 14:38:46 UTC
Fixed following Marti's suggestion in branch and trunk