Skip to main content

[JAI] Tiff Group4 Compression

1 reply [Last post]
Anonymous

Hello,
I need quickly help for my problem,
my application scan image and save it in tiff format with Group4 compression,
but when i open this file by using "Imaging for Windows, Kodak" i found that the pixel is inverted as white pixel become black,and black pixel becomes white.
so i invert the pixel befor saving then every thing was good by using "Imaging for Windows, Kodak" and another viwer is "AutoEDMS aVue".
**invert code:
-------------------

public BufferedImage invert(PlanarImage image)
{
BufferedImage buf_image = image.getAsBufferedImage();
DataBufferByte dataBufferByte = (DataBufferByte) buf_image.getRaster().getDataBuffer();
byte[] buffer = dataBufferByte.getData();
for (int lll = 0; lll < buffer.length; lll++) {
buffer[lll] = (byte) (~buffer[lll]);
}
return buf_image
}

but when i use Microsoft Office Document Imaging or Photoshop or open it by using JAI the pixel is inverted,
and also when iuse it with any ocr sdk i have to invert the pixel befor use.
Summary, i want a solution to save in tif format with group 4, and this file is viewing
correctly in all foramt.
i am sorry if any one don't understand what i mean, as my english is not good.

---------------------------------
Yahoo! Mail
Stay connected, organized, and protected. Take the tour
[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
loki der quaeler

hello -

this is an oft discussed issue which could be better researched by
searching the jai-interest archives.

the summary of the problem, is that you are likely working with a
min-is-black indexColorModel. the problem arrives that some viewers,
upon seeing a group 4 compression, ignore the photometric
interpretation field in the tiff-header and assume the data is
min-is-white (so your min-is-black data will be rendered inverted).
since there's no way to fix other peoples' dodgy viewers, it's sanest
just to create and work with min-is-white in your code for images that
you know will be written with group4 compression.

loki

On 5 May, 2005, at 11.02, Dalia Kamal wrote:

> Hello,
> I need quickly help for my problem,
> my application scan image and save it in tiff format with Group4
> compression,
> but when i open this file by using "Imaging for Windows, Kodak" i
> found that the pixel is inverted as white pixel become black,and black
> pixel becomes white.
> so i invert the pixel befor saving then every thing was good by using
> "Imaging for Windows, Kodak" and another viwer is "AutoEDMS aVue".
> **invert code:
> -------------------
>  
>  public BufferedImage invert(PlanarImage image)
>   {
>      BufferedImage buf_image = image.getAsBufferedImage();
>      DataBufferByte dataBufferByte = (DataBufferByte)
> buf_image.getRaster().getDataBuffer();
>      byte[] buffer = dataBufferByte.getData();
>      for (int lll = 0; lll < buffer.length; lll++) {
>             buffer[lll] = (byte) (~buffer[lll]);
>           }
>      return buf_image
>   }
>
> but when i use Microsoft Office Document Imaging or Photoshop or open
> it by using JAI the pixel is inverted,
> and also when iuse it with any ocr sdk i have to invert the pixel
> befor use.
> Summary, i want a solution to save in tif format with group 4, and
> this file is viewing
> correctly in all foramt.
> i am sorry if any one don't understand what i mean, as my english is
> not good.
>
> Yahoo! Mail
> Stay connected, organized, and protected. Take the tour
[att1.dat]