•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 402,811 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,064 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 290 | Replies: 9
![]() |
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,239
Reputation:
Rep Power: 10
Solved Threads: 270
You may want to work with Java Advanced Imaging API or Java - ImageIO. Both have very useful forums on java.net (JAI, ImageIO)
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
•
•
Join Date: Jul 2008
Posts: 32
Reputation:
Rep Power: 0
Solved Threads: 0
i see the libraries. but still no clue where to start
all I want is to read a image to a BufferedImage of a jpeg with cmyk
if not possible than I would most likely go by converting a image with some class than make that class output the image into a bytearray stream.
looking at jaiimageio but not sure can i use it to convert a image.
all I want is to read a image to a BufferedImage of a jpeg with cmyk
if not possible than I would most likely go by converting a image with some class than make that class output the image into a bytearray stream.
looking at jaiimageio but not sure can i use it to convert a image.
•
•
Join Date: Jul 2008
Posts: 32
Reputation:
Rep Power: 0
Solved Threads: 0
well i found a code that uses jai but the returned byte array image color isnt right.
public static BufferedImage convertCMYKtoRGB(byte[] ba) throws Exception {
int[] bitsCMYK = {8, 8, 8, 8};
ICC_ColorSpace csCMYK = new ICC_ColorSpace(ICC_Profile.getInstance(SharedData.WRITELOCATION + "images\\pdf\\CMYK.pf"));
ColorModel colorModelCMYK = new ComponentColorModel(csCMYK, bitsCMYK, false, false, java.awt.Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
ImageLayout cmykLayout = new ImageLayout();
cmykLayout.setColorModel(colorModelCMYK);
RenderingHints rh = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, cmykLayout);
ByteArraySeekableStream bais = new ByteArraySeekableStream(ba);
ParameterBlock params = new ParameterBlock();
params.add(bais);
RenderedOp op = JAI.create("stream", params, rh);
bais.close();
ColorSpace csRGB = null;
csRGB = ColorSpace.getInstance(ColorSpace.CS_sRGB);
ColorModel colorModel = new ComponentColorModel(csRGB, bitsCMYK, false, false, java.awt.Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
ImageLayout il = new ImageLayout();
il.setSampleModel(colorModel.createCompatibleSampleModel(op.getWidth(), op.getHeight()));
RenderingHints hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, il);
ParameterBlock pb = new ParameterBlock();
pb.addSource(op).add(colorModel);
il = new ImageLayout();
il.setSampleModel(colorModel.createCompatibleSampleModel(op.getWidth(), op.getHeight()));
hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, il);
RenderedOp opNeu = JAI.create("ColorConvert", pb, hints);
BufferedImage img = opNeu.getAsBufferedImage();
return img;
} Last edited by TheBuzzer : Jul 24th, 2008 at 4:58 pm.
•
•
Join Date: Jul 2008
Posts: 32
Reputation:
Rep Power: 0
Solved Threads: 0
I also tried
the color isnt right for this too.
PlanarImage inImage = JAI.create("fileload",SharedData.WRITELOCATION + (String) theorder.get("ordertype") + "Data\\" + String.valueOf((Integer) theorder.get("hiddenkey")) + "\\logos\\cappreview\\" + (String) theorder.getItem(item).get("previewfilename"));
BufferedImage realimage = inImage.getAsBufferedImage();
the color isnt right for this too.
Some of the info in this bug report might be of use:
http://bugs.sun.com/bugdatabase/view...bug_id=4799903
http://bugs.sun.com/bugdatabase/view...bug_id=4799903
Last edited by Ezzaral : Jul 24th, 2008 at 5:13 pm.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the Java Forum
- Previous Thread: JComboBox problems
- Next Thread: Get Locale from System Date



Linear Mode