Saving an image in Tiff issue

I would like to save a sequence of Tiff images (from an Avi sequence), on which I have drawn some lines with the paintbrush (painted on overlay on all images).

When I save them as Jpeg, it’s ok, the lines appear on the saved images.
But when I save them as Tiff, it does not work.
How can I make these lines appear on saved TIFF images?
Thanks in advance


Hi @Bill,

since your “lines” are drawn in the overlay, they will be stored as a separate overlay into the TIFF file. However, when exporting to JPEG, an overlay is automatically flattened (Image > Overlay > Flatten). The Flatten command will create an RGB image that has the overlay written into the pixel intensities which you can subsequently save as TIFF. Be aware that you cannot change elements of the overlay after flattening an image.


I know that it’s been long time since you responded on this thread,
But by chance, do you remember how to flatten a stack, rather than a single tiff image?

You need to do a z-projection: Image > Stacks >Z Project…
Choose the projection method depending on your application.

Maximum Intensity projection are fine for visualization for quantification afterwards an average or sum projection is warranted.


Thanks for the reply @schmiedc
Any chance you know how I should do this when developing Java?
Possibly when using ImagePlus?

Have a look at the zprojector:

Thank you very much!
I was really stuck!

1 Like

Sorry to bother again,
But I still get the same result after projection, meaning all overlays of different slices are drawn over the first slice, and only that slice is shown.

Here’s a code snippet if you’re interested.
I appreciate any help.

ImagePlus imp = ImageJFunctions.wrap(argbImg, “blobs”);

    Overlay overlay = new Overlay();
    for (int i = 1; i < 50; i++) {
        Line line = new Line(100 + i*5, 100, 200 + i*5, 200);
        // line.setPosition(1, 1, 1 + i);
    ZProjector zProjector = new ZProjector(imp);

You would need to run the ZProjector with

But I am confused now? You want to project a .tiff or zStack correct?


I want to add an overlay on each layer of the stack.

Actually the run method is just a static method of the same code that I wrote here.
So no difference in that regard.

Ah ok then I misunderstood you. Sorry.
The ZProjector is not a solution for you.

Here are some threads that talk about that and provide solutions:

Thanks for the response,
So there’s a flattenStack() method, but it does not work!
I don’t think there’s a solution here!

Just out of curiosity, do you know how to draw a line on an image, not using overlays?
I need to set the color, and the width, so the drawLine in the imageProcessor does not work either!

You could maybe try the fill method of the image processor.