473,624 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 IndexedColorMod el).

Anyone can help me?. This is the source code:
MemoryCacheSeek ableStream seekStream = new
MemoryCacheSeek ableStream (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 = ColorConvertDes criptor.create (img, cm,
null).getAsBuff eredImage();
Thanks in advance,
Andres
Jul 17 '05 #1
0 3634

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

Similar topics

0
2028
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 something to do with not having the path set right or something. Any ideas? I have windows XP BTW. Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/jai/PlanarImage Adam
0
6693
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 really puzzled why it doesn't work public PlanarImage thresholding (PlanarImage source) { // set up the histogram int bins = { 256 }; double low = { 0.0D };
0
1677
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 can print them out to a JTextArea as they appear in the Konqueror (KDE) browser. When working in Linux, the images still fail to load properly when I attempt to do so with JAI. Is there something special I need to do with JAI in order for it to...
0
3059
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 sure what it is doing. The code is below: public void adjustLight(int ipParam){ // ipParam = 18 pb = new ParameterBlock();
4
7033
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? However, even if it is technically feasible, it can take long time to do the conversion, especially the HTML is complicated. Is there any other more efficient way? Thanks!
0
2004
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 CCITT3/4 compression for faxing. The .Tiff file appears to be created successfully however when I try to send the file as a fax I get the error: System.Runtime.InteropServices.COMException (0x8007000D): The data is
5
5978
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 TIFF to several PNG files this causes a problem, becuase the resulting image is (the page to the far left and a lot of black space surrounding it and a filesize that is larger than needed. Any ideas?
6
10024
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 the client machine, the file type TIFF is associated with Kodak Imaging Preview. This app works on most client machines. When you click on the link, Kodak Imaging Preview will open the TIFF file on the client machine. However, on some machines, the...
1
2993
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 well. I want do some image manipulation on the extracted tiff images, for which I intend to use LibTiff on Macintosh. The problem right now I am facing is that LibTiff api TIFFOpen returns
0
8174
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8336
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1485
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.