Saved image includes Pixel Inspection Tool marker

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Saved image includes Pixel Inspection Tool marker

J. Lewis Muir-2
Hello!

In ImageJ 1.52s, if I select the Pixel Inspection Tool and click on a
pixel in an image and then save the image as GIF, JPEG, or PNG, the
red box indicating the selected pixel of the Pixel Inspection Tool is
included in the image!  This is very surprising and undesirable.  I
think this must be a bug.  Can anyone confirm?

I found that this does not occur (i.e., the red box is not included in
the saved image) if I instead save as TIFF or BMP.

Here's how to reproduce:

1. Choose File > New > Image.

2. Accept the defaults (e.g., 8-bit, fill with black, 512x512 pixels)
   and click OK.

3. Select the Pixel Inspection Tool.

4. Click somewhere in the image on a pixel (e.g., x=75, y=75) which
   displays a small red box indicating the pixel that is currently being
   inspected.

5. Choose File > Save As > Gif (or Jpeg or PNG).

6. Open the saved image with a different image viewer and observe that
   the red box is in the image!

Thank you!

Lewis

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Saved image includes Pixel Inspection Tool marker

Herbie
Good day Lewis,

I've just tested it (IJ-version 1.52t) and realized that the selected area
is in fact an overlay. When saving images with overlays in JPG- or
PNG-format, they are flattened, i.e. the overlay is imprinted onto the
image. This behavior isn't a bug.

What you can do, if you don't like the red square being imprinted, is go to
"Image >> Overlay >> Remove Overlay".

Regards

Herbie

:::::::::::::::::::::::::::::::::::::::::::

J. Lewis Muir-2 wrote

> Hello!
>
> In ImageJ 1.52s, if I select the Pixel Inspection Tool and click on a
> pixel in an image and then save the image as GIF, JPEG, or PNG, the
> red box indicating the selected pixel of the Pixel Inspection Tool is
> included in the image!  This is very surprising and undesirable.  I
> think this must be a bug.  Can anyone confirm?
>
> I found that this does not occur (i.e., the red box is not included in
> the saved image) if I instead save as TIFF or BMP.
>
> Here's how to reproduce:
>
> 1. Choose File > New > Image.
>
> 2. Accept the defaults (e.g., 8-bit, fill with black, 512x512 pixels)
>    and click OK.
>
> 3. Select the Pixel Inspection Tool.
>
> 4. Click somewhere in the image on a pixel (e.g., x=75, y=75) which
>    displays a small red box indicating the pixel that is currently being
>    inspected.
>
> 5. Choose File > Save As > Gif (or Jpeg or PNG).
>
> 6. Open the saved image with a different image viewer and observe that
>    the red box is in the image!
>
> Thank you!
>
> Lewis
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html





--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Saved image includes Pixel Inspection Tool marker

Stein Rørvik
I agree with Herbie, this is not a bug but the intended behaviour.

I do this often; I insert overlays containing scalebars and markings with arrows, annotated boxes etc and then save as a TIFF first to create an "original" image with the annotations as a removable overlay; then I save the image as a PNG or JPG to have the annotations "burnt in" for easy inclusion in a report or sharing by email.

Stein

-----Original Message-----
Sent: 13. februar 2020 14:54
To: [hidden email]
Subject: Re: Saved image includes Pixel Inspection Tool marker

Good day Lewis,

I've just tested it (IJ-version 1.52t) and realized that the selected area is in fact an overlay. When saving images with overlays in JPG- or PNG-format, they are flattened, i.e. the overlay is imprinted onto the image. This behavior isn't a bug.

What you can do, if you don't like the red square being imprinted, is go to "Image >> Overlay >> Remove Overlay".

Regards

Herbie

:::::::::::::::::::::::::::::::::::::::::::

J. Lewis Muir-2 wrote

> Hello!
>
> In ImageJ 1.52s, if I select the Pixel Inspection Tool and click on a
> pixel in an image and then save the image as GIF, JPEG, or PNG, the
> red box indicating the selected pixel of the Pixel Inspection Tool is
> included in the image!  This is very surprising and undesirable.  I
> think this must be a bug.  Can anyone confirm?
>
> I found that this does not occur (i.e., the red box is not included in
> the saved image) if I instead save as TIFF or BMP.
>
> Here's how to reproduce:
>
> 1. Choose File > New > Image.
>
> 2. Accept the defaults (e.g., 8-bit, fill with black, 512x512 pixels)
>    and click OK.
>
> 3. Select the Pixel Inspection Tool.
>
> 4. Click somewhere in the image on a pixel (e.g., x=75, y=75) which
>    displays a small red box indicating the pixel that is currently being
>    inspected.
>
> 5. Choose File > Save As > Gif (or Jpeg or PNG).
>
> 6. Open the saved image with a different image viewer and observe that
>    the red box is in the image!
>
> Thank you!
>
> Lewis
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Saved image includes Pixel Inspection Tool marker

J. Lewis Muir-2
In reply to this post by Herbie
On 02/13, Herbie wrote:
> I've just tested it (IJ-version 1.52t) and realized that the selected area
> is in fact an overlay. When saving images with overlays in JPG- or
> PNG-format, they are flattened, i.e. the overlay is imprinted onto the
> image. This behavior isn't a bug.
>
> What you can do, if you don't like the red square being imprinted, is go to
> "Image >> Overlay >> Remove Overlay".

Hello, Herbie!

Thank you for your reply!  I confirm that choosing Image > Overlay >
Remove Overlay removes the red box, even with the Pixel Inspection Tool
selected and results in a clean image without the red box when saved as
PNG.

I still feel that this is a bug, though.  If it's not a bug, then it's
at least really surprising and confusing behavior, IMO.  All I did
was create a new image and use the Pixel Selection Tool to inspect a
pixel.  I never created an overlay or did anything with an overlay.  It
is very unexpected to me that saving an image would result in an image
containing the graphical cursor from an inspection tool I happened to
use.  It would almost be like leaving my mouse cursor hovering over
the image and then saving the image only to discover that the mouse
cursor had been saved in the image as if I had taken a screenshot of the
window.  I really don't see how this is reasonable behavior.

Now, if I had instead chosen, e.g., the Text Tool, entered some text,
and then had chosen Edit > Draw, then I could see this behavior as
reasonable.  But for an inspection tool like the Pixel Inspection Tool,
it just makes no sense that the cursor for the tool would be saved in
the image.

I had a look at the Magnifying Glass Tool to see if it has the same
behavior as the Pixel Inspection Tool, and it does not.  I selected the
Magnifying Glass Tool, zoomed in to 300%, and it displayed two purple
boxes in the top-left corner.  I then chose File > Save As > PNG, and
the resulting image does *not* include the purple boxes.  This seems
entirely reasonable and is what I would expect.

Thank you!

Lewis

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Saved image includes Pixel Inspection Tool marker

J. Lewis Muir-2
In reply to this post by Stein Rørvik
On 02/13, Stein Rørvik wrote:
> I agree with Herbie, this is not a bug but the intended behaviour.
>
> I do this often; I insert overlays containing scalebars and markings with arrows, annotated boxes etc and then save as a TIFF first to create an "original" image with the annotations as a removable overlay; then I save the image as a PNG or JPG to have the annotations "burnt in" for easy inclusion in a report or sharing by email.

I understand your use case for overlays, and that seems entirely
reasonable to me.  But in my case, I didn't create any overlays, and
I didn't add any markings nor annotations.  I simply used the Pixel
Inspection Tool to inspect a pixel in the image, yet when I saved the
image, I found that the tool cursor (i.e., the small red box) had been
saved in the image!

Kind regards,

Lewis

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Saved image includes Pixel Inspection Tool marker

Herbie
In reply to this post by J. Lewis Muir-2
Lewis,

The problem is with the Pixel Inspection Tool not with ImageJ.

If the square were a selection, not an overlay, then no imprinting would
occur. So if you should really like to complain, you should address the
author.

In general the behavior of ImageJ to flatten images saved in JPG- or
PNG-format is perfectly ok and I judge it highly desirable.

Regards

Herbie

:::::::::::::::::::::::::::::::::::::::::::
Am 13.02.20 um 15:29 schrieb J. Lewis Muir:

> On 02/13, Herbie wrote:
>> I've just tested it (IJ-version 1.52t) and realized that the selected area
>> is in fact an overlay. When saving images with overlays in JPG- or
>> PNG-format, they are flattened, i.e. the overlay is imprinted onto the
>> image. This behavior isn't a bug.
>>
>> What you can do, if you don't like the red square being imprinted, is go to
>> "Image >> Overlay >> Remove Overlay".
>
> Hello, Herbie!
>
> Thank you for your reply!  I confirm that choosing Image > Overlay >
> Remove Overlay removes the red box, even with the Pixel Inspection Tool
> selected and results in a clean image without the red box when saved as
> PNG.
>
> I still feel that this is a bug, though.  If it's not a bug, then it's
> at least really surprising and confusing behavior, IMO.  All I did
> was create a new image and use the Pixel Selection Tool to inspect a
> pixel.  I never created an overlay or did anything with an overlay.  It
> is very unexpected to me that saving an image would result in an image
> containing the graphical cursor from an inspection tool I happened to
> use.  It would almost be like leaving my mouse cursor hovering over
> the image and then saving the image only to discover that the mouse
> cursor had been saved in the image as if I had taken a screenshot of the
> window.  I really don't see how this is reasonable behavior.
>
> Now, if I had instead chosen, e.g., the Text Tool, entered some text,
> and then had chosen Edit > Draw, then I could see this behavior as
> reasonable.  But for an inspection tool like the Pixel Inspection Tool,
> it just makes no sense that the cursor for the tool would be saved in
> the image.
>
> I had a look at the Magnifying Glass Tool to see if it has the same
> behavior as the Pixel Inspection Tool, and it does not.  I selected the
> Magnifying Glass Tool, zoomed in to 300%, and it displayed two purple
> boxes in the top-left corner.  I then chose File > Save As > PNG, and
> the resulting image does *not* include the purple boxes.  This seems
> entirely reasonable and is what I would expect.
>
> Thank you!
>
> Lewis
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Saved image includes Pixel Inspection Tool marker

Gabriel Landini
In reply to this post by J. Lewis Muir-2
On Thursday, 13 February 2020 14:52:28 GMT you wrote:
> I understand your use case for overlays, and that seems entirely
> reasonable to me.  But in my case, I didn't create any overlays, and
> I didn't add any markings nor annotations.

Hi Lewis, well, the tool you chose uses overlays and that is what matters;
that is how it works.
Any tool/plugin/script that uses overlays will behave like that.
It is documented that overlays are burnt into the jpeg or png files, so it is
definitely not a bug. Maybe you could say "unexpected behaviour", but since
you now know about it, it is not so unexpected anymore.

> I simply used the Pixel
> Inspection Tool to inspect a pixel in the image, yet when I saved the
> image

Yes, the issue is that you chose to save in a format which burns in the
overlays. Save as Tiff and you will be fine.

If you really need to save in jpeg without overlays there are many ways to do
this:
* reload the saved Tiff and re-save as jpeg, or
* switch the overlays off and save, or
* switch off the pixel inspector and save, or
* duplicate the original and run the pixel inspector in the copy and save the
original.

Hope it helps

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Saved image includes Pixel Inspection Tool marker

J. Lewis Muir-2
On 02/13, Gabriel Landini wrote:

> On Thursday, 13 February 2020 14:52:28 GMT you wrote:
> > I understand your use case for overlays, and that seems entirely
> > reasonable to me.  But in my case, I didn't create any overlays, and
> > I didn't add any markings nor annotations.
>
> Hi Lewis, well, the tool you chose uses overlays and that is what matters;
> that is how it works.
> Any tool/plugin/script that uses overlays will behave like that.
> It is documented that overlays are burnt into the jpeg or png files, so it is
> definitely not a bug. Maybe you could say "unexpected behaviour", but since
> you now know about it, it is not so unexpected anymore.

Hi, Gabriel!

Thank you for the explanation.  OK, "unexpected behavior," then. :-)  If
I submit a patch to change the behavior of the Pixel Inspection Tool to
not use overlays (or to do whatever the Magnifying Glass Tool does since
it is able to render graphics on top of the image and yet those graphics
do not get saved in the image), would it likely be accepted?

Thank you!

Lewis

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Saved image includes Pixel Inspection Tool marker

Wayne Rasband-2
In reply to this post by J. Lewis Muir-2
> On Feb 13, 2020, at 8:15 AM, J. Lewis Muir <[hidden email]> wrote:
>
> Hello!
>
> In ImageJ 1.52s, if I select the Pixel Inspection Tool and click on a
> pixel in an image and then save the image as GIF, JPEG, or PNG, the
> red box indicating the selected pixel of the Pixel Inspection Tool is
> included in the image!  This is very surprising and undesirable.  I
> think this must be a bug.  Can anyone confirm?

This bug is fixed in the latest ImageJ daily build (1.52u9).

-wayne

>
> I found that this does not occur (i.e., the red box is not included in
> the saved image) if I instead save as TIFF or BMP.
>
> Here's how to reproduce:
>
> 1. Choose File > New > Image.
>
> 2. Accept the defaults (e.g., 8-bit, fill with black, 512x512 pixels)
>   and click OK.
>
> 3. Select the Pixel Inspection Tool.
>
> 4. Click somewhere in the image on a pixel (e.g., x=75, y=75) which
>   displays a small red box indicating the pixel that is currently being
>   inspected.
>
> 5. Choose File > Save As > Gif (or Jpeg or PNG).
>
> 6. Open the saved image with a different image viewer and observe that
>   the red box is in the image!
>
> Thank you!
>
> Lewis

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Saved image includes Pixel Inspection Tool marker

Gabriel Landini
On Thursday, 13 February 2020 16:03:04 GMT [hidden email] wrote:
> This bug is fixed in the latest ImageJ daily build (1.52u9).
>
> -wayne

OK, it was a bug then.  :-)
To save *with* the overlay as before (and like in all other instances using
overlays) one can use the command Image>Overlay>Flatten

Cheers

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html