473,729 Members | 2,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Saving a BufferedImage as a JPEG

I am saving a BufferedImage as a JPEG file under Windows XP.
I am using the JAI JPEGImageEncode r class.
The JPEG is saved as CMYK but I need RGB.
I cannot figure out how to get RGB. Any help?
Jul 17 '05 #1
1 7134

"Michael Johnston" <mi************ ****@saic.com> wrote in message
news:72******** *************** ***@posting.goo gle.com...
I am saving a BufferedImage as a JPEG file under Windows XP.
I am using the JAI JPEGImageEncode r class.
The JPEG is saved as CMYK but I need RGB.
I cannot figure out how to get RGB. Any help?


Where is the BufferedImage coming from? If you're creating the object
yourself, try using INT_RGB imageType instead of the default ARGB.

image = new BufferedImage(x , y, BufferedImage.T YPE_INT_RGB);

It might also be worth trying this:

JPEGImageEncode r encoder = JPEGCodec.creat eJPEGEncoder(os );
JPEGEncodeParam param = encoder.getDefa ultJPEGEncodePa ram(image);
encoder.encode( img, param);

Jul 17 '05 #2

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

Similar topics

0
2344
by: Ron Brennan | last post by:
Good evening. I want to read a .jpeg into a BufferedImage with anImageReader.read(0, param) that I would then like to reduce (make a thumbnail more or less) and save as another file with anImageWriter.write(aBufferedImage). My (theoretical) options seem to be to reduce it while I'm reading it, reduce it from the BufferedImage, or reduce it while I'm writing it. BufferedImage is of course a subtype of Image and Image has a
5
6319
by: news.west.cox.net | last post by:
I have a fairly simple Python program that uses Image and ImageDraw to create poll results on the fly. Because PIL only supports 256 colors for GIF and BMPs are huge (in comparison)... I have opted to create JPEGs. I have installed JPEG-6b and have checked to see that all of the libraries are in the correct, expected places. But, I am still getting the following error.
3
3623
by: cdj | last post by:
Hi all, I've got a picturebox on a form, and a save button. When I go to save, the app craps out with the following error: ================== An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in system.drawing.dll
5
4732
by: TheGanjaMan | last post by:
Hi everyone, I'm trying to write up a simple image stamper application that stamps the Exif date information from the jpegs that I've taken from my digital camera and saves the new file with the date stamped on the lower right part of the picture. (I'm not an advanced programmer so my code may not be 100% efficient - sorry, I'm still learning) Everything works fine until the saving part. I've been able to read the file into a...
6
3517
by: NutsAboutVB | last post by:
Hello, I am a .NET programmer and I have a JPEG image file (from digital camera) of about 109 KB's in size, when I open it and save it (without making any alterations at all, just going to File --> Save) in MS Photo Editor, the file is automatically shrunk in size to 81 KB's. When doing the same thing in MS Paint, the file is shrunk to 54 KB's. The file has the same number of pixels after both saves (as expected). My question follows...
1
7079
by: Manticure | last post by:
I want to get the R, G and B components as integers (0-255). I use this: Rectangle area = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); BufferedImage bufferedImage = r.createScreenCapture(area); int pixel = bufferedImage.getRGB(x,y); But it returns some crazy 1 value of -65536 or something like that. How do I convert it to three individual integers R,G and B?
3
6205
by: eagles | last post by:
I'm trying to save a BufferedImage as a .tiff. The following: ImageIO.write(bufferedImg, "TIFF", new File("file.tiff")); is returning false. Do I need to use JAI? I'm just trying to use the easiest way to save a .tiff. Thanks.
7
17245
by: pamela fluente | last post by:
I have been using something like: public void SaveJPG(Image Image, string FileName, long QualityLevel_0_100, long ColorDepthLevel) { ImageCodecInfo ImageCodecInfoJPG = GetEncoderInfo("image/jpeg"); EncoderParameters EP = new EncoderParameters(2); EP.Param(0) = new EncoderParameter(Encoder.Quality, QualityLevel_0_100); EP.Param(1) = new EncoderParameter(Encoder.ColorDepth,
0
2029
by: ne0lithic | last post by:
Hey everyone, I'm working on a program based on steganography. For this, i need to access the individual pixels and perform my manipulations. FYI, I do not have the JAI library available with me and I have to make do with awt, imageIO and image. I'm having no issues in loading an image but when i thought I would test things and just save the same image without manipulation I was surprised. After copying the pixels from the image into an int...
0
8761
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
9280
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
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
9142
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...
0
8144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
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
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
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
2677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.