Convert a monochrome (1bit) image into a grayscale (8bit) one

  • Thread starter =?ISO-8859-1?Q?Christian_H=F6ntsch-Rode?=
  • Start date
?

=?ISO-8859-1?Q?Christian_H=F6ntsch-Rode?=

Hi all !

I'm using the JAI to load pages from a tiff image (the file was created
by a fax-server). Now I want to convert each page into a 8bit grayscale
image to increase the quality when I reseize the image.
Does anyone know how to convert 1bit monochrome images into 8bit
grayscale images ? The sun java forum only describes the reverse way...

TIA

Christian
 
D

dingo

If you convert it the quality will not improve. Fakt is you lost detail
during faxing.
TM
 
?

=?ISO-8859-1?Q?Christian_H=F6ntsch-Rode?=

dingo said:
If you convert it the quality will not improve. Fakt is you lost detail
during faxing.
TM

Yes of course, I'm loosing a bit of quality, but I want to display
thumbnails of all pages from a received Fax message. When I rescale a
typical 1728x2280 pixel 1bit-tiff to a thumbnail-size of 100x100
(maintaining the aspect ratio!) I can't read anything on the thumbnail.
When I go to Paitshop or Photoshop, convert the image into a grayscale
one and resize it, I got a really good thumbnail quality. Now I want to
do this with JAI...
 
A

Aquila Deus

Christian said:
Hi all !

I'm using the JAI to load pages from a tiff image (the file was created
by a fax-server). Now I want to convert each page into a 8bit grayscale
image to increase the quality when I reseize the image.
Does anyone know how to convert 1bit monochrome images into 8bit
grayscale images ? The sun java forum only describes the reverse
way...

It's impossible to do a lostless convert like that. You may, however,
use blur effect after the convertion. But this may not improve the
quality if your image contains mainly text or drawing.
 
N

Niels Dybdahl

I'm using the JAI to load pages from a tiff image (the file was created
If you convert it the quality will not improve. Fakt is you lost detail
during faxing.

That is not correct. If you scale an 8bpp image to another 8bpp image, you
can use bilinear og bicubic interpolation to make the scaled image more
smooth. If you scale an 1bpp image to another 1bpp image, then the resulting
image will look awful.

The basic method of conversion from 1bpp to 8bpp is to count the number of
set pixels within a certain area (f.ex 1x1 or 8x8 pixels), scale the result
into the range 0..255 and use that as the resulting 8b pixel value. I do not
know if JAI has functions for that.

There can be various approaches depending upon the original (screens that
require filters adapted to the screen density, thin lines that should be
preserved or emphasized etc) and whether your scaled image should be
converted back to 1bpp again.

Niels Dybdahl
 
A

Andrey Kuznetsov

I'm using the JAI to load pages from a tiff image (the file was created by
a fax-server). Now I want to convert each page into a 8bit grayscale image
to increase the quality when I reseize the image.
Does anyone know how to convert 1bit monochrome images into 8bit grayscale
images ? The sun java forum only describes the reverse way...

SubsampleBinaryToGray operator
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top