Skip to main content

[JAI-IMAGEIO] Image file size changes

2 replies [Last post]
Anonymous

Hi!
Can anyone tell me how to prevent JAI from changing the images I only open?
I just open with "imageread" and write with "imagewrite" without
making any changes to the image. The problem is that the image size of
the new image, which shoud be a copy of the original, is different in
size (a few bytes). I think there are some compression algorithms
playing a role here, but I don't want JAI to touch my images without
my consentment. Can anyone please help?
Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Fabrizio Giudici

On Jul 20, 2006, at 24:28 , Tony Power wrote:

> Hi!
> Can anyone tell me how to prevent JAI from changing the images I
> only open?
> I just open with "imageread" and write with "imagewrite" without
> making any changes to the image. The problem is that the image size of
> the new image, which shoud be a copy of the original, is different in
> size (a few bytes). I think there are some compression algorithms
> playing a role here, but I don't want JAI to touch my images without
> my consentment. Can anyone please help?
> Thank you.

I think you should give us some more details about what you're doing
(e.g. the
file format you're using) to understand what's happening. For
instance, if you're
working with JPEGs, saving an opened jpeg unavoidably re-compresses
it, and this
happens for every lossy compression format - this mean that something
must be
changed in the application, but again it depends on what you want to
do. If you're
using a lossless or uncompressed format, the small difference can be
due to the fact
that metadata can be arranged in many different ways, even if
semantically equivalent.
Of course, it could even be a bug.

--
Fabrizio Giudici, Ph.D. - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
http://www.tidalwave.it/blog - Fabrizio.Giudici@tidalwave.it
mobile: +39 348.150.6941 - fax: +39 027.005.105.36

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Tony Power

I am sorry, you are right.

Reading:
ParameterBlock pb = new ParameterBlock();
pb.add("xpto.tiff");
imagem = JAI.create("imageread", pb);

Writing:
ParameterBlock pb = new ParameterBlock();
pb.addSource(image);
pb.add("xpto2.tiff");
JAI.create("imagewrite", pb);

The reduction on size happens on tiff(not lossy) and jpeg. Haven't
tryed with other fomats, but I believe it will happen the same.
I have been comparing the jpeg files size by size and I believe the
images are slightly different (or my eyes are mistaking).
On the tiff, appart from size, I don't think the image is changed.

Thank you ;)

On 7/19/06, Fabrizio Giudici wrote:
>
> On Jul 20, 2006, at 24:28 , Tony Power wrote:
>
> > Hi!
> > Can anyone tell me how to prevent JAI from changing the images I
> > only open?
> > I just open with "imageread" and write with "imagewrite" without
> > making any changes to the image. The problem is that the image size of
> > the new image, which shoud be a copy of the original, is different in
> > size (a few bytes). I think there are some compression algorithms
> > playing a role here, but I don't want JAI to touch my images without
> > my consentment. Can anyone please help?
> > Thank you.
>
> I think you should give us some more details about what you're doing
> (e.g. the
> file format you're using) to understand what's happening. For
> instance, if you're
> working with JPEGs, saving an opened jpeg unavoidably re-compresses
> it, and this
> happens for every lossy compression format - this mean that something
> must be
> changed in the application, but again it depends on what you want to
> do. If you're
> using a lossless or uncompressed format, the small difference can be
> due to the fact
> that metadata can be arranged in many different ways, even if
> semantically equivalent.
> Of course, it could even be a bug.
>
> --
> Fabrizio Giudici, Ph.D. - Java Architect, Project Manager
> Tidalwave s.a.s. - "We make Java work. Everywhere."
> http://www.tidalwave.it/blog - Fabrizio.Giudici@tidalwave.it
> mobile: +39 348.150.6941 - fax: +39 027.005.105.36
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net