BUG across all CP versions. Self "enhancing" black images

Dear all, my name is Tom and I work in Stockholm University, Sweden.
I need you help.
I have image set that need some basic cropping and I noticed that CP behaves in a very weird way with some images.
For simplicity, we have 2 images, a GOOD and BAD. A “bad” one has a white stipe at the top, only couple px thick. This stripe I need to remove.
The problem exists in all CP ver. I tested (1.0;2.0;2.1.0;2.1.1)
I also tested it on MAC and Windows. Same problem.

If I pretend to remove the stripe from the “good” picture

  • if cropped X (25) - from edge; Y (25) - from edge = WORKS
  • if cropped X (15-end) - absolute; Y (15-end) - absolute = WORKS
  • if cropped X (0-2000) - absolute; Y (0-2000) - absolute = WORKS

If the “bad” is cropped in the same way:

  • if cropped X (25) - from edge; Y (25) - from edge = it completely changes the picture
  • if cropped X (15-end) - absolute; Y (15-end) - absolute = it completely changes the picture
  • if cropped X (0-2000) - absolute; Y (0-2000) - absolute = patch stays, as expected

I am uploading images and a pipeline, guys, I will greatly appreciate your help. I have noticed some time back that CP freaks out a bit when processing almost black pictures.
Best regards,

forum.cpproj (522 KB)

Hi Tom,

I may be misunderstanding things, but are you assessing whether the picture has changed by whether the image looks different or not in the module display window? If so, this can be misleading, since the default display option is to normalize the display depending on the pixel values, and this can different depending on what you select in Crop.

I noticed that you selected “No” for “Remove empty rows and columns” in Crop. This might be responsible for what you are seeing as if you choose not to remove the empty regions, they are replaced with zeros (i.e, black), as per the help docs. So in this case, yes, the image is changed and inclusion of 0’s would likely change how the picture is displayed. If the image was using the whole dynamic range (as in the “good” image), you might not notice the difference, whereas for a dim image (i.e, the “bad” one) adding 0’s has a more dramatic effect.

That’s a long-winded way of recommending that you select “All” for this setting unless you have a good reason not too :smiley:


Many thanks Mark !
Indeed CP optimizes image display for more eye-friendly preview.
Thank you a lot for you quick response !
Have a great day !!

And also note that you can always look at the “Raw”, unscaled, pixel values of a display window by right-clicking (command-click on Mac) a display window-> Image Contrast -> Raw. This is a good way to compare the true values that CellProfiler will be processing.