Jpeg headers not saved after editing the image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Jpeg headers not saved after editing the image

vsomasundar
Hi,

I have some jpeg images that have special headers such as the time the image was taken and the camera ID they belong to. Now when I do some editing on the image such as cropping or filtering and save the result with a new file name, these headers are not being saved. Is there anyway I could propagate these headers to the new image too?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Jpeg headers not saved after editing the image

Herbie-3
Good day no-name,

are you able to read the special headers?

If yes, you may restore them after the image processing as ImageJ metadata.

Have a look at <http://rsb.info.nih.gov/ij/developer/macro/functions.html>.

BTW, be aware that JPEG-compressed images are unsuited for scientific
image processing and evaluation.

HTH

Herbie

:::::::::::::::::::::::::::::::::::::
On 22.01.14 00:11, vsomasundar wrote:

> Hi,
>
> I have some jpeg images that have special headers such as the time the image
> was taken and the camera ID they belong to. Now when I do some editing on
> the image such as cropping or filtering and save the result with a new file
> name, these headers are not being saved. Is there anyway I could propagate
> these headers to the new image too?
>
> Thanks
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Jpeg-headers-not-saved-after-editing-the-image-tp5006218.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> 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: Jpeg headers not saved after editing the image

Michael Schmid
In reply to this post by vsomasundar
Hi Vinay (if I guessed your name correctly from the email address),

if the original data are in the EXIF data, you can use the EXIF Reader plugin from the ImageJ homepage. Then, use a macro to write metadata [setMetadata("Info", string)].

You have to save the image as .zip or .tif, then the metadata are preserved.
As Herbie said, don't save as jpeg, it is a lossy compression, maybe for display in a presentation, not for analysis. Thus, ImageJ does not care about saving metadata to JPEGs.

Much better, if your camera supports a non-lossy format like TIFF or RAW, use that format already for recording.

Michael
________________________________________________________________
On Jan 22, 2014, at 00:11, vsomasundar wrote:

> Hi,
>
> I have some jpeg images that have special headers such as the time the image
> was taken and the camera ID they belong to. Now when I do some editing on
> the image such as cropping or filtering and save the result with a new file
> name, these headers are not being saved. Is there anyway I could propagate
> these headers to the new image too?
>
> Thanks
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Jpeg-headers-not-saved-after-editing-the-image-tp5006218.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> 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: Jpeg headers not saved after editing the image

Jon Harman-3
In reply to this post by Herbie-3
Hi Herbie,
I think that is too strong of a statement against jpegs.  Whether jpeg
is suitable or not depends on the analysis being done and the amount of
compression being applied.  The original imaging method is often
responsible for gross distortions and the jpeg compression artifacts are
minor in comparison.

For example I used to work for a CT manufacturer.  Radiologists
routinely created images with resolution far beyond what the physical
resolution of our machine justified.  A little jpeg compression on top
of this makes no difference.

Jpeg has taken over imaging, for better or worse. (If only jpeg2000 had
taken hold before the consumer digital cameras, alas.)  ImageJ should
support jpegs as well as it supports tiffs.

Jon


> BTW, be aware that JPEG-compressed images are unsuited for scientific
> image processing and evaluation.
>
> HTH
>
> Herbie
>

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

Re: Jpeg headers not saved after editing the image

Herbie-3
Jon,

there are several aspects you didn't mention...

Yes there is lossless JPEG and there is no reason to criticize its use
but I'm not aware of someone really using it.

Compression strength in fact makes a difference but not if the task of
image processing or analysis is crucial. I've seen some false medical
decisions based on compression artifacts and I don't wish anybody to
suffer from a false diagnosis.

You are right, there are many, many other cases of image artifacts but
this doesn't justify to neglect those caused to JPEG compression.

Wrong:
[...] images with resolution far beyond what the physical resolution of
our machine justified.  A little jpeg compression on top of this makes
no difference.
Physical resolution and jpeg compression artifacts are unrelated.

I stay with what I said and especially today there is no reason for
compressed images if they are used in scientific or critical context
such as a medical one. Storage is cheap and transmission bandwidth
became reasonable high even for large uncompressed images if they really
need to be transmitted in near to real-time.

A final aspect is that if you tolerate a certain and perhaps harmless
amount of JPEG artifacts you will be misunderstood by most of our fellow
scientist who are not image processing specialists. The result will be
that people think that JPEG compression poses no problem at all...

Finally, there is no reason to criticize JPEG compression with everyday
(consumer) camera use, surveillance purposes, etc.

BTW ImageJ opens and saves images with JPEG compression and there are
good reasons for this feature but such images are not suited for
scientific or otherwise critical purposes.

Best regards

Herbie

::::::::::::::::::::::::::::::::::::
On 22.01.14 18:53, Jon Harman wrote:

> Hi Herbie,
> I think that is too strong of a statement against jpegs.  Whether jpeg
> is suitable or not depends on the analysis being done and the amount of
> compression being applied.  The original imaging method is often
> responsible for gross distortions and the jpeg compression artifacts are
> minor in comparison.
>
> For example I used to work for a CT manufacturer.  Radiologists
> routinely created images with resolution far beyond what the physical
> resolution of our machine justified.  A little jpeg compression on top
> of this makes no difference.
>
> Jpeg has taken over imaging, for better or worse. (If only jpeg2000 had
> taken hold before the consumer digital cameras, alas.)  ImageJ should
> support jpegs as well as it supports tiffs.
>
> Jon
>
>
>> BTW, be aware that JPEG-compressed images are unsuited for scientific
>> image processing and evaluation.
>>
>> HTH
>>
>> Herbie
>>
>

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