jpeg artifacts

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

jpeg artifacts

John Brear
Hi,
I am relatively new to ImageJ - investigating its suitability for quantitative metallography, particularly precipitate particle characterisation.  My apologies, therefore, if I am treading on well-worn ground.

In the user guide I see strong warnings against using jpeg images, see 'Noteworthy II, X'.
However, I cannot reproduce the effects described, neither using the exmple image of the mandril/baboon (which is supplied as a jpeg anyway??), nor using my own images.  I have tried comparing bmp, jpg, tif, gif, png.

Is this advice still current?
If so, can someone supply a definitive, reproducible example that I and my team can use as a test case?

Thanks in anticipation,
Best wishes,
John

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

Re: jpeg artifacts

ctrueden
Hi John,

> can someone supply a definitive, reproducible example
> that I and my team can use as a test case?

Here is a macro which demonstrates the issue:

----------
// load Boats
run("Boats (356K)");
run("Out [-]");
rename("Original");

// convert to JPEG
run("Duplicate...", " ");
run("Out [-]");
run("Save As JPEG... [j]", "jpeg=85");
run("Revert");
rename("JPEG");

// compute the difference
imageCalculator("Subtract create 32-bit", "Original","JPEG");
run("Out [-]");
rename("Difference");

// display windows side by side
run("Tile");

// highlight artifacts using Glasbey LUT
selectWindow("Original");
run("glasbey");
selectWindow("JPEG");
run("glasbey");
selectWindow("Difference");
----------

See also
http://imagej.net/Principles#Why_.28lossy.29_JPEGs_should_not_be_used_in_imaging

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - http://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - http://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


On Wed, Mar 23, 2016 at 1:30 PM, John Brear <
[hidden email]> wrote:

> Hi,
> I am relatively new to ImageJ - investigating its suitability for
> quantitative metallography, particularly precipitate particle
> characterisation.  My apologies, therefore, if I am treading on well-worn
> ground.
>
> In the user guide I see strong warnings against using jpeg images, see
> 'Noteworthy II, X'.
> However, I cannot reproduce the effects described, neither using the
> exmple image of the mandril/baboon (which is supplied as a jpeg anyway??),
> nor using my own images.  I have tried comparing bmp, jpg, tif, gif, png.
>
> Is this advice still current?
> If so, can someone supply a definitive, reproducible example that I and my
> team can use as a test case?
>
> Thanks in anticipation,
> Best wishes,
> John
>
> --
> 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 artifacts

Michael Schmid
In reply to this post by John Brear
Hi John,

here is another very simple example where you can see the artifacts with
the bare eye, even at 100% JPEG quality (you can set it in
Edit>Options/Input/Output). The lines get a colored 'halo'.

newImage("Untitled", "RGB ramp", 100, 100, 1);
setForegroundColor(255, 0, 0);
makeLine(17, 16, 93, 85);
run("Draw", "slice");
setForegroundColor(255, 255, 0);
makeLine(21, 60, 88, 15);
run("Draw", "slice");
setForegroundColor(0, 255, 0);
makeLine(67, 77, 45, 17);
run("Draw", "slice");
setForegroundColor(0, 255, 255);
makeLine(23, 40, 78, 34);
run("Draw", "slice");
setForegroundColor(0, 0, 255);
makeLine(11, 23, 86, 76);
run("Draw", "slice");
setForegroundColor(255, 0, 182);
makeLine(44, 83, 67, 10);
run("Draw", "slice");
run("Select None");
tempFilePath = getDirectory("temp")+"temp_temp.jpg";
saveAs("Jpeg", tempFilePath);
run("Revert"); //read the JPEG
File.delete(tempFilePath);
run("In [+]");
run("In [+]");
run("In [+]");
run("In [+]");
run("In [+]");

Michael
________________________________________________________________
On 2016-03-23 19:30, John Brear wrote:

> Hi,
> I am relatively new to ImageJ - investigating its suitability for quantitative metallography, particularly precipitate particle characterisation.  My apologies, therefore, if I am treading on well-worn ground.
>
> In the user guide I see strong warnings against using jpeg images, see 'Noteworthy II, X'.
> However, I cannot reproduce the effects described, neither using the exmple image of the mandril/baboon (which is supplied as a jpeg anyway??), nor using my own images.  I have tried comparing bmp, jpg, tif, gif, png.
>
> Is this advice still current?
> If so, can someone supply a definitive, reproducible example that I and my team can use as a test case?
>
> Thanks in anticipation,
> Best wishes,
> John
>
> --
> 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 artifacts

Herbie
In reply to this post by John Brear
John,

apart from the clearcut visualizations by Curtis and Michael I'm puzzled
by your question:

"Is this advice still current?"

JPEG is a _lossy_ compression technique that was standardized back in
1992/94 (ISO/IEC 10918-1:1994):

<http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=18902>

Why do you think things have changed since?
A standard is a standard, is a standard, ...

PNG is a nice alternative (standardized in 2004) for _lossless_ compression.
<https://en.wikipedia.org/wiki/Portable_Network_Graphics>

In general lossy compression is unsuited for scientific image processing
and analyses. And please keep in mind that processing JPEG images and
again compressing them as JPEGs gives rise to further artifacts (for
exceptions see <https://en.wikipedia.org/wiki/JPEG>)!

Best

Herbie

::::::::::::::::::::::::::::::::::::::::
Am 23.03.16 um 19:30 schrieb John Brear:

> Hi, I am relatively new to ImageJ - investigating its suitability for
> quantitative metallography, particularly precipitate particle
> characterisation.  My apologies, therefore, if I am treading on
> well-worn ground.
>
> In the user guide I see strong warnings against using jpeg images,
> see 'Noteworthy II, X'. However, I cannot reproduce the effects
> described, neither using the exmple image of the mandril/baboon
> (which is supplied as a jpeg anyway??), nor using my own images.  I
> have tried comparing bmp, jpg, tif, gif, png.
>
> Is this advice still current? If so, can someone supply a definitive,
> reproducible example that I and my team can use as a test case?
>
> Thanks in anticipation, Best wishes, John
>
> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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