SaveImages module is smoothing image?




I was trying to save an image with segmented outlines, but the segmentation outlines always look kind of blurred. I am using CellProfiler 2.2 on a windows machine.

I have 4 segmented outlines (blue, green, ornage and red) and in addition 4 object centers from the module ExpandOrShrinkObjects -> Shrink object to a point. Now, in the CP window (right side of screen shot) I get a sharp and 1 pixel width outline and the point objects are actually 1 pixel in size (even when I zoom in on pixel level). However, when I open the saved image (left side of screen shot) it looks smoothed (or resized) no matter what image format I tried (.png, .tif, .tiff). The point objects are always 4 pixel in size. The image dimension fit to its original size.

Do I miss something or is this intended? How can I get the full resolution image from CP?

Many thanks in advance!




Can you upload the pipeline and an input image so that we can look at your settings and attempt to reproduce this?


thanks for the quick reply. Here is the pipeline and a set of images…
ps: just move the images into the same folder, I had to split them into two zips to be able to upload them here…

CP2.2_BeadSegmentation_4colors.cpproj (1.1 MB) (10.1 MB) (11.2 MB)


To try and help with this I’ve located one specific bead in both images and have put them side to side here.

I believe what you are perceiving as smoothing is due to the difference between the output of OverlayOutlines and saved the RGB image. It looks to me that at that point CellProfiler is showing your original image with outlines on top (they are not PART of the image at this point). If you overlay the mouse the pixels have the same intensity values whether they are “coloured” or not. However, making an RGB image these seven outlines have to be flattened onto the greyscale image resulting in the difference (each pixel now has three intensity values and all the information has to be represented like that). Somehow this results in these kind of halos around the outlines which result in them looking a little wider - although I don’t agree with your four pixel suggestion.

To give you an another possible option, I used GrayToColour to generate a composite image and then saved that which is my third image. Obviously you have the issue where outlines overlap there is merging of the colours but if you’d mind that or not depends on what you want to do with the images I guess.


I confess I don’t know much the generation of RGB images in CellProfiler or any other programs but I thought if I displayed this then maybe someone more in the know could comment further. I’m not well versed on all the save options available to you either. Additionally, perhaps there are further options in 3.0.0 if you were happy to upgrade.


Dear Laura,
thank you for your reply.
Sorry to say that, but I dont agree with your statement

Saving and image as RGB should not result in these “smoothing artifacts”.

I went back and had a more closer look. It turns out that this “smoothing artifacts” depends on the position in the image. Here you will find some beads all from the same image, strarting from the top-left:





and middle-middle:

As you can see there is a y-smoothing in the middle-left and a x-smoothing in the top-middle, but not in the corners. When you look in the center (middle-middle) then you can see and x- and y-smoothing, resulting in the “4 pixel smoothing”.

Anyway, I also checked the module OverlyOutlines (2 steps before saving) and saved that image:

no “smoothing artifacts”!

To me it seems that the module DisplayDataOnImage (last step before saving) produces this “smoothing artifacts” (however invisible in CellProfiler itself). The effect could be explained if the “overlay matrix” is 1 pixel different in size in x and y direction. Then the overlays have to be interpolated and the smoothing effect is largest in the middle in each direction (one pixel is interpolated to two pixels). Also, if you look into the background noise you can see changes after DisplayDataOnImage.
Anyway, to me it looks like a bug in the module DisplayDataOnImage.

Since we use CP2.2 on our cluster this is the preferred version.

Many thanks and best regards!



Hi Martin,

Looks like you are right! Sorry, because you specifically mentioned SaveImages I focused on that and didn’t pay enough attention to your DisplayDataOnImage module so I went on a wild goose chase… I guess free forum advice is worth what you pay for it :).

It seems some anti-aliasing is happening when text is saved by CellProfiler. A workaround would be to start saving just the overlay of the text measurements and composite the overlay image and your image with outlines later. This way, your outlines remain as you see them in CellProfiler.

I tried to recreate it in CP3.0 and was unable to so if it’s really bothering you and it was feasible you could upgrade but I assume this isn’t too big a problem and more an annoyance?



Hi Laura,
thanks for the quick reply and the workaround.
Yeah, it is annoying but I can live with it.
If this is not reproducible in CP3.0 thats good.


Hi Martin,
DisplayDataOnImage is a bit more complicated than it seems under the hood- it’s actually saving a copy of a copy of an image, essentially. It’s not designed to be super precise, more of a “helpful-overlay-for-quick-data-exploration-tool”. Sorry for the confusion!