473,378 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

JAI: Tiff b/w to gray

I'm using JAI for reading Tiff images: black and white, 1 bit depth. I
want to scale them to reduce their size, but I want to do
antialiasing. If I scale them as they are (using the scale operator)
the images remain b/w and no antialiasing is done (I'm using bilinear
interpolation).

So I'm trying to convert the image to gray before scaling. But an
exception raises when trying to do the ColorConvert operation, because
"the number of bands in the source raster image is different of the
number of components in the source color space" (normal, because it's
an IndexedColorModel).

Anyone can help me?. This is the source code:
MemoryCacheSeekableStream seekStream = new
MemoryCacheSeekableStream (image);
TIFFDecodeParam tiffParam = new TIFFDecodeParam();
img = TIFFDescriptor.create (seekStream, tiffParam, new
Integer(0), null);
byte [] c = new byte[256];
for (int i=0; i<c.length; i++) c[i] = (byte) i;
ColorModel cm = new IndexColorModel (8,256, c,c,c);
img = ColorConvertDescriptor.create (img, cm,
null).getAsBufferedImage();
Thanks in advance,
Andres
Jul 17 '05 #1
0 3615

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Oracle3001 | last post by:
Hi All, I have installed JAI and compiled a Thresholding example from the offical sun site. However when I come to run the application I get the following error message. I thinking it is probably...
0
by: Oracle3001 | last post by:
Hi All, I am trying to use JAI to build a histogram of an image i have. I have posted the code below, and the error I get at runtime. I have taken the code from the offical java examples, so I am...
0
by: Nicholas Pappas | last post by:
Hello all. I'm still having some trouble with getting Java work its way through Korean directories and filenames. I was able to load the strings in properly (using Cp1252 as the charset), and...
0
by: Amy | last post by:
Hi, I have written a program using JAI for a project I am doing which can be used to adjust the brightness of an image. It all works fine but I now need to write it all up and am not entirely...
4
by: Dominic | last post by:
Hi guys, In .NET, how can I convert a HTML file to TIFF efficiently? One possible way is that I can first use word automatation to load the HTML up and then print it to TIFF. Is that right?...
0
by: Will Arrowsmith | last post by:
Hi All, I am trying to create a .tiff file to fax using the windows fax service FAXCOMLib. I have created an array of images (bitmaps) and converted them to 1pbb format in order to allow...
5
by: Shane Story | last post by:
I can seem to get the dimensions of a frame in a multiframe tiff. After selecting activeframe, the Width/Height is still really much larger than the page's actual dimensions. When I split a...
6
by: qysbc | last post by:
I have a web page and there is a link to open a TIFF file. The way I do it is to have the server code open a binary stream, set the content type to "image/tiff" and call Response.BinaryWrite. On...
1
by: amit gupta | last post by:
Hello, I am using QuarkXPress on Macintosh to generate EPS Files with Tiff Preview embedded in it. I have written some C code to extract Tiff Preview from EPS files generated which works pretty...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.