Better jpeg quality

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

Better jpeg quality

Jon Harman
Hi,

Is there a plugin to ImageJ that gives better jpeg quality than the Sun
version of jpeg at quality of 100?  For instance many photo editing
programs produce better quality at highest setting than ImageJ.  There
seems to be no standard for this.  My concern is with color resolution.
  For example Irfanview allows you to turn off jpeg color sub sampling.

Thanks for any info,
Jon
Reply | Threaded
Open this post in threaded view
|

jar html

Adrian Martin
Hello all,

Having written my plugin, I thought it would be nice to have a help  
file within the .jar file that I can call up from within the plugin.  
Its in HTML so I would think that should be easy but it isn't.  I can  
get an HTML file opened, but not one from within a .jar file.
Any ideas about this?

ps I've seen the .jar file example plugin

Dr Adrian Martin
Sensor Sciences,  3333 Vincent Road, Suite 103, Pleasant Hill, CA 94523
(925) 296 0848 phone, (925) 296 0849 fax
Reply | Threaded
Open this post in threaded view
|

Re: Better jpeg quality

Albert Cardona
In reply to this post by Jon Harman
Jon,

There is no such plugin, but you can have a look yourself at the
com.sun.image.codec.jpeg.*  classes, particuarly:

JPEGImageEncoder encoder =
JPEGCodec.createJPEGEncoder(f);                          

JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi)


and the decoder equivalents.

But be warned: half the time one doesn't get the parameters right, and
the jpg file fails to decode.


Albert

--
Albert Cardona
http://www.mcdb.ucla.edu/Research/Hartenstein/acardona
Reply | Threaded
Open this post in threaded view
|

Re: jar html

Jeffrey B. Woodward
In reply to this post by Adrian Martin
Maybe I don't understand your question, but with the limited information
that I see in your posting, the obvious answer would seem to be to use
Class.getResourceAsStream()

-Woody



Adrian Martin wrote:

> Hello all,
>
> Having written my plugin, I thought it would be nice to have a help
> file within the .jar file that I can call up from within the plugin.  
> Its in HTML so I would think that should be easy but it isn't.  I can
> get an HTML file opened, but not one from within a .jar file.
> Any ideas about this?
>
> ps I've seen the .jar file example plugin
>
> Dr Adrian Martin
> Sensor Sciences,  3333 Vincent Road, Suite 103, Pleasant Hill, CA 94523
> (925) 296 0848 phone, (925) 296 0849 fax
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Better jpeg quality

Harry Parker
In reply to this post by Jon Harman
Hi Jon,

If IrfanView does what you want, why not use IrfanView?

One option you have is to call IrfanView to do the JPEG compression from within ImageJ.
You could write an ImageJ macro to save your image as a standard TIFF file and then call IrfanView via an exec() macro function call to convert the file to JPEG as you like.

See the exec function description at
    http://rsb.info.nih.gov/ij/developer/macro/functions.html#E
 and the example macros the exec function documentation points to.
 
--  
Harry Parker  
Senior Systems Engineer  
Digital Imaging Systems, Inc.

----- Original Message ----
From: Jon Harman <[hidden email]>
To: [hidden email]
Sent: Tuesday, February 19, 2008 12:58:06 PM
Subject: Better jpeg quality


Hi,

Is
there
a
plugin
to
ImageJ
that
gives
better
jpeg
quality
than
the
Sun
version
of
jpeg
at
quality
of
100?  
For
instance
many
photo
editing
programs
produce
better
quality
at
highest
setting
than
ImageJ.  
There
seems
to
be
no
standard
for
this.  
My
concern
is
with
color
resolution.
 
For
example
Irfanview
allows
you
to
turn
off
jpeg
color
sub
sampling.

Thanks
for
any
info,
Jon





      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
Reply | Threaded
Open this post in threaded view
|

Re: Better jpeg quality

Jon Harman
In reply to this post by Albert Cardona
Hi,

Thanks for pointing me in that direction.
The code
             int i0 = param.getHorizontalSubsampling(0);
             int i1 = param.getHorizontalSubsampling(1);
             int i2 = param.getHorizontalSubsampling(2);
              IJ.write("Horiz:" + i0 + " " + i1 + " " + i2);
             int j0 = param.getVerticalSubsampling(0);
             int j1 = param.getVerticalSubsampling(1);
             int j2 = param.getVerticalSubsampling(2);
             IJ.write("Vert:" + j0 + " " + j1 + " " + j2);
produces the results:
Horiz:1 2 2
Vert:1 2 2
I think that this means the subsampling is set to 2 for the two color
channels and to 1 for the brightness channel.

The code:
             param.setHorizontalSubsampling(1, 1);
             param.setHorizontalSubsampling(2, 1);
             param.setVerticalSubsampling(1, 1);
             param.setVerticalSubsampling(2, 1);
produces the results:
Horiz:1 1 1
Vert:1 1 1

The output has better quality for colors, but poorer compression at the
same quality number.

My guess is that this is what Irfanview does.

Since I am very interested in colors I think it would be great if ImageJ
would give the option to set the jpeg color subsampling to 1.



Jon


Albert Cardona wrote:

> Jon,
>
> There is no such plugin, but you can have a look yourself at the
> com.sun.image.codec.jpeg.*  classes, particuarly:
>
> JPEGImageEncoder encoder =
> JPEGCodec.createJPEGEncoder(f);                        
> JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi)
>
>
> and the decoder equivalents.
>
> But be warned: half the time one doesn't get the parameters right, and
> the jpg file fails to decode.
>
>
> Albert
>
Reply | Threaded
Open this post in threaded view
|

Re: jar html

J H-4
In reply to this post by Adrian Martin
Hi
    See http://www.codeguru.com/forum/showthread.php?t=343536 for an example
of showing html from a jar in a textbox.  If you want it to show up in the
standard browser things get trickier, google "open browser from java" or see
http://forum.java.sun.com/thread.jspa?threadID=679673

Hope this helps.


On 2/19/08, Adrian Martin <[hidden email]> wrote:

>
> Hello all,
>
> Having written my plugin, I thought it would be nice to have a help
> file within the .jar file that I can call up from within the plugin.
> Its in HTML so I would think that should be easy but it isn't.  I can
> get an HTML file opened, but not one from within a .jar file.
> Any ideas about this?
>
> ps I've seen the .jar file example plugin
>
> Dr Adrian Martin
> Sensor Sciences,  3333 Vincent Road, Suite 103, Pleasant Hill, CA 94523
> (925) 296 0848 phone, (925) 296 0849 fax
>
Reply | Threaded
Open this post in threaded view
|

Re: jar html

ctrueden
Hi,

If you want it to show up in the
> standard browser things get trickier, google "open browser from java" or
> see
> http://forum.java.sun.com/thread.jspa?threadID=679673
>

ImageJ includes a version of Eric Albert's BrowserLauncher class for
launching URLs into the OS's default browser. Should be as simple as calling
ij.plugin.BrowserLauncher.openURL("http://www.myurl.com/").

-Curtis

On Feb 20, 2008 12:09 PM, J H <[hidden email]> wrote:

> Hi
>    See http://www.codeguru.com/forum/showthread.php?t=343536 for an
> example
> of showing html from a jar in a textbox.  If you want it to show up in the
> standard browser things get trickier, google "open browser from java" or
> see
> http://forum.java.sun.com/thread.jspa?threadID=679673
>
> Hope this helps.
>
>
> On 2/19/08, Adrian Martin <[hidden email]> wrote:
> >
> > Hello all,
> >
> > Having written my plugin, I thought it would be nice to have a help
> > file within the .jar file that I can call up from within the plugin.
> > Its in HTML so I would think that should be easy but it isn't.  I can
> > get an HTML file opened, but not one from within a .jar file.
> > Any ideas about this?
> >
> > ps I've seen the .jar file example plugin
> >
> > Dr Adrian Martin
> > Sensor Sciences,  3333 Vincent Road, Suite 103, Pleasant Hill, CA 94523
> > (925) 296 0848 phone, (925) 296 0849 fax
> >
>