----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 20, 2001 1:44 AM
Subject: Re: Support for ICC profiles and CMYK jpeg


>
> hi Thomas,
>
> I can't download the source code that you provided for rendering  CMYK
jpeg
> in pdf file, so, can you please send it to me, thank you very much.
>
>
> best rgds,
> ektan



hallo ektan,

i send you now the source-code for the image convert.

thanks

thomas kübler

    private void convert2(PrintWriter outp,String rgbdatei,boolean invert) {

 int[] bitsCMYK = {8,8,8,8};//  bits für den cmyk-Datensatz

 String cmykProfile = "e:/icc/infoColor.icc"; // icc-profile cmyk
 String rgbProfile = "e:/icc/sRGB Profile.icc";// icc-profile rgb

 // Dateiname für die Ausgabe
 StringTokenizer st = new StringTokenizer(rgbdatei,".");
 StringBuffer buffer = new StringBuffer();
     while ( st.hasMoreTokens() ) {
  buffer.append(st.nextToken());
  buffer.append("_cmyk");
  buffer.append(".jpg");
  break;
     }

 try {

     RenderedImage inputRGB = JAI.create("fileload",rgbdatei);

     // Create a CMYK Color Space from cmykProfile
     ICC_Profile p = ICC_Profile.getInstance(new
FileInputStream(cmykProfile));
     ColorSpace csCMYK = new ICC_ColorSpace(p);


     ColorModel colorModelCMYK = new
ComponentColorModel(csCMYK,bitsCMYK,false,false,
           Transparency.OPAQUE,
           DataBuffer.TYPE_BYTE);

     ImageLayout cmykLayout = new ImageLayout();
     cmykLayout.setColorModel(colorModelCMYK);
     RenderingHints hints = new
RenderingHints(JAI.KEY_IMAGE_LAYOUT,cmykLayout);

cmykLayout.setSampleModel(colorModelCMYK.createCompatibleSampleModel(inputRG
B.getWidth(),inputRGB.getHeight()));

     java.awt.image.renderable.ParameterBlock pb = new
java.awt.image.renderable.ParameterBlock();
     pb.addSource(inputRGB);
     pb.add(csCMYK);
     // convert the image from rgb-colorspace to cmyk-colorspace with icc
     PlanarImage out = JAI.create("ColorConvert",pb,hints);

     // Damit photoshop die Bilddaten nicht invertiert anzeigt erfolgt
     // eine invertierung der Daten
     pb = new java.awt.image.renderable.ParameterBlock();
     pb.addSource(out);
     PlanarImage out2 = JAI.create("invert",pb);

     WritableRaster cmykRaster = out2.copyData();
     // Öffnen des Output-Streams
     OutputStream datei = new FileOutputStream(buffer.toString());

     JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(datei);
     JPEGEncodeParam param =
encoder.getDefaultJPEGEncodeParam(cmykRaster,param.COLOR_ID_CMYK);
     param.setQuality(1, false);
     encoder.encode(cmykRaster, param);
     datei.close();
     outp.println("Bild erfolgreich gespeichert");

 } catch (Exception e) {
     e.printStackTrace();
 }
    }
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to