Converting cmyk compressed images to rgb compressed format

Hi,
I need some help in converting of CMYK images to RGB images. I got some sample code from internet but I get some run time exceptions with that and I'm not able to figure out the reason for the same. Pls help me in fixing the same. Any help will be sincerely appreicated.
The code is given below :
import java.awt.image.*;
import java.awt.image.renderable.*;
import java.awt.color.*;
import java.awt.event.*;
import java.awt.*;
import java.io.*;
import java.net.*;
import javax.media.jai.*;
import com.sun.image.codec.jpeg.*;
public class CMYKTest1 {
  public static void main(String args[]) throws Exception{
     RenderedOp op = JAI.create("fileload", "Kristopher Brock LOGO.jpg");
     ColorModel rgbcm = op.getColorModel();
     ICC_Profile profile = ICC_Profile.getInstance("CMYK.pf");
//     ICC_Profile profile = ICC_Profile.getInstance(ColorSpace.TYPE_CMYK);
     ICC_ColorSpace icp = new ICC_ColorSpace(profile);
     ColorModel colorModel =
          RasterFactory.createComponentColorModel(op.getSampleModel().getDataType(),
                                                            icp,
                                                            false,
                                                            false,
                                                            Transparency.OPAQUE);
     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);
     op = JAI.create("ColorConvert", pb, hints);
     pb = new ParameterBlock();
     pb.addSource(op).add(rgbcm);
     il = new ImageLayout();
     il.setSampleModel(rgbcm.createCompatibleSampleModel(op.getWidth(),
                                                                      op.getHeight()));
     hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, il);
     op = JAI.create("ColorConvert", pb, hints);
     JAI.create("filestore", op, "earthrgb.jpg", "JPEG", null);
     BufferedImage img = op.getAsBufferedImage(null, null);
     OutputStream fout = new FileOutputStream("earthrgb1.jpg");
     JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(fout);
     JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(img);
     param.setQuality(1, false);
     param.setXDensity(300);
     param.setYDensity(400);
     encoder.encode(img, param);
     fout.close();
}I get the following error:
Caused by: java.lang.IllegalArgumentException: Numbers of source Raster bands and source color space components do not match
     at java.awt.image.ColorConvertOp.filter(Unknown Source)
     at com.sun.media.jai.opimage.ColorConvertOpImage.computeRectNonColorSpaceJAI(ColorConvertOpImage.java:373)
     at com.sun.media.jai.opimage.ColorConvertOpImage.computeRect(ColorConvertOpImage.java:290)
     at javax.media.jai.PointOpImage.computeTile(PointOpImage.java:914)
     at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
     at javax.media.jai.OpImage.getTile(OpImage.java:1129)
     at javax.media.jai.PointOpImage.computeTile(PointOpImage.java:911)
     at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
     at javax.media.jai.OpImage.getTile(OpImage.java:1129)
     at com.sun.media.jai.codecimpl.JPEGImageEncoder.encode(JPEGImageEncoder.java:173)
     at com.sun.media.jai.opimage.EncodeRIF.create(EncodeRIF.java:70)
     ... 24 more
Error: One factory fails for the operation "filestore"
Occurs in: javax.media.jai.ThreadSafeOperationRegistry
java.lang.reflect.InvocationTargetException
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     at java.lang.reflect.Method.invoke(Unknown Source)
     at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
     at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
     at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
     at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
     at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819)
     at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
     at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888)
     at javax.media.jai.JAI.createNS(JAI.java:1099)
     at javax.media.jai.JAI.create(JAI.java:973)
     at javax.media.jai.JAI.create(JAI.java:1668)
     at CMYKTest1.main(CMYKTest1.java:79)
Caused by: javax.media.jai.util.ImagingException: All factories fail for the operation "encode"
     at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1687)
     at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
     at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
     at com.sun.media.jai.opimage.FileStoreRIF.create(FileStoreRIF.java:138)
     ... 15 moreThanks & Regards,
Magesh.

The following code converts an cmyk jpeg image into an rgb jpeg image.
The only problem if this code is that it loads the whole image in memory and thus you'll need a lot of RAM when converting large images. For example, it take around 300 MB to convert a 3000*3800px image (this is a 5MB jpeg image when compressed on disk).
import com.sun.image.codec.jpeg.JPEGImageEncoder;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGEncodeParam;
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;
import javax.imageio.metadata.IIOMetadata;
import javax.imageio.metadata.IIOMetadataNode;
import java.util.*;
import java.io.*;
import java.awt.image.*;
import java.awt.*;
import java.awt.color.ColorSpace;
import org.w3c.dom.NodeList;
public class Test {
    public static void main(String[] args) throws Exception {
        BufferedImage i1 = readImage(new File("cmyk.jpg"));
        BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(new File("rgb.jpg")));
        JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
        JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(i1);
        param.setQuality(1, false);
        encoder.setJPEGEncodeParam(param);
        encoder.encode(i1);
    public Test() {
    // extract metadata
    public static BufferedImage readImage(File file) throws IOException {
        // Get an ImageReader.
        ImageInputStream input = ImageIO.createImageInputStream(file);
        Iterator readers = ImageIO.getImageReaders(input);
        if (readers == null || !readers.hasNext()) {
            throw new RuntimeException("No ImageReaders found");
        ImageReader reader = (ImageReader) readers.next();
        reader.setInput(input);
        String format = reader.getFormatName();
        if ("JPEG".equalsIgnoreCase(format) || "JPG".equalsIgnoreCase(format)) {
            IIOMetadata metadata = reader.getImageMetadata(0);
            String metadataFormat = metadata.getNativeMetadataFormatName();
            IIOMetadataNode iioNode = (IIOMetadataNode) metadata.getAsTree(metadataFormat);
            NodeList children = iioNode.getElementsByTagName("app14Adobe");
            if (children.getLength() > 0) {
                iioNode = (IIOMetadataNode) children.item(0);
                int transform = Integer.parseInt(iioNode.getAttribute("transform"));
                Raster raster = reader.readRaster(0, reader.getDefaultReadParam());
                if (input != null) {
                    input.close();
                reader.dispose();
                return createJPEG4(raster, transform);
        throw new RuntimeException("No ImageReaders found");
     * Java's ImageIO can't process 4-component
     * images
     * <p/>
     * and Java2D can't apply AffineTransformOp
     * either,
     * <p/>
     * so convert raster data to
     * RGB.
     * <p/>
     * Technique due to MArk
     * Stephens.
     * <p/>
     * Free for any
     * use.
    private static BufferedImage createJPEG4(Raster raster, int xform) {
        int w = raster.getWidth();
        int h = raster.getHeight();
        byte[] rgb = new byte[w * h * 3];
        // if (Adobe_APP14 and transform==2) then YCCK else CMYK
        if (xform == 2) {    // YCCK -- Adobe
            float[] Y = raster.getSamples(0, 0, w, h, 0, (float[]) null);
            float[] Cb = raster.getSamples(0, 0, w, h, 1, (float[]) null);
            float[] Cr = raster.getSamples(0, 0, w, h, 2, (float[]) null);
            float[] K = raster.getSamples(0, 0, w, h, 3, (float[]) null);
            for (int i = 0, imax = Y.length, base = 0; i < imax; i++, base += 3) {
                float k = 220 - K, y = 255 - Y[i], cb = 255 - Cb[i], cr = 255 - Cr[i];
double val = y + 1.402 * (cr - 128) - k;
val = (val - 128) * .65f + 128;
rgb[base] = val < 0.0 ? (byte) 0 : val > 255.0 ? (byte) 0xff : (byte) (val + 0.5);
val = y - 0.34414 * (cb - 128) - 0.71414 * (cr - 128) - k;
val = (val - 128) * .65f + 128;
rgb[base + 1] = val < 0.0 ? (byte) 0 : val > 255.0 ? (byte) 0xff : (byte) (val + 0.5);
val = y + 1.772 * (cb - 128) - k;
val = (val - 128) * .65f + 128;
rgb[base + 2] = val < 0.0 ? (byte) 0 : val > 255.0 ? (byte) 0xff : (byte) (val + 0.5);
else {
// assert xform==0: xform;
// CMYK
int[] C = raster.getSamples(0, 0, w, h, 0, (int[]) null);
int[] M = raster.getSamples(0, 0, w, h, 1, (int[]) null);
int[] Y = raster.getSamples(0, 0, w, h, 2, (int[]) null);
int[] K = raster.getSamples(0, 0, w, h, 3, (int[]) null);
for (int i = 0, imax = C.length, base = 0; i < imax; i++, base += 3) {
int c = 255 - C[i];
int m = 255 - M[i];
int y = 255 - Y[i];
int k = 255 - K[i];
float kk = k / 255f;
rgb[base] = (byte) (255 - Math.min(255f, c * kk + k));
rgb[base + 1] = (byte) (255 - Math.min(255f, m * kk + k));
rgb[base + 2] = (byte) (255 - Math.min(255f, y * kk + k));
// from other image types we know InterleavedRaster's can be
// manipulated by AffineTransformOp, so create one of
// those.
raster = Raster.createInterleavedRaster(new DataBufferByte(rgb, rgb.length), w, h, w * 3, 3, new int[]{0, 1, 2}, null);
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
ColorModel cm = new ComponentColorModel(cs, false, true, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
return new BufferedImage(cm, (WritableRaster) raster, true, null);

Similar Messages

  • Converting 10-bit image to RGB 24

    I am using the IMAQ 1409 board to acquire black and white image in 10-bit format. Using the vision software I am type-casting this image into an RGB image. Later am saving the images into an AVI file using VIs from developer zone. The images are saved as RGB 24 bit on the AVI file. Am I losing resolution/information when going from 10-bit to RGB 24?

    Carlos,
    During the conversion process, the 10 bit image is converted to 8 bits, which is the maximum grayscale range for an RGB image. You are losing some information, but it is likely that it is not significant. For most applications, 8 bit grayscale is adequate.
    Bruce
    Bruce Ammons
    Ammons Engineering

  • Is there a trick to converting JPG from RGB to CMYK without the lossy re-compression?

    So I've got around 750 images in multiple categories and folders. Each image has 6 variants - 16 bit TIFF from over-eager beaver photographer, 16 bit TIFF, extracted backgrounds (done by student workers, who do not use English as we are not in the US), then, standardized 3000x2000 (or other suitable aspect ratio) PNG with corrected edges for web and light print, an 1800x1200 JPG for web and a few smaller PNG standards also for web.
    The 16 bit TIFFs with Extracted BG are the root files, and a series of actions builds the PNG's. The standardized PNG's are then pumped through actions and Image Processor to create output files.
    So I just discovered that a seemingly random number of these are in CMYK. That hasn't been a problem up until now because our website and our printed materials have no problem with CMYK and RGB files.
    But now we are starting to hand out these images to our customers - who are only interested in the 1800x1200 JPG and maybe 900x600 PNG files, which are most easily pulled directly from our website rather than sending them the entire 180gb graphics directory.
    And some of them are telling us that the pictures are being rejected. Most notably, Ebay does not allow CMYK files.
    So damage control- rebuild our entire library of images from the 16 bit TIFFs
    OR
    rebuild only a couple of different sizes and upload from there, replacing the pictures on the next major update (over the next year).
    I am *NOT* concerned about preserving color since 99% of our products are black and shades of grey, with only a hint of color.
    I am concerned about the degradation of changing mode on 60-70% compressed images, then resaving again with the lossy JPG compression.
    I'm about to start ripping into things with my actions and replacing around 1500 files online, so I'd like to be sure that I'm doing things in the most sensible way.
    If there's a tool that can do this conversion without another pass of compression, that would be ideal.

    My understanding of the JPG is only middling. I thought I understood that it uses anchor pixels and either a translation table of some sort or difference mapping, using 8 bits per piece of information.
    If that were the case, surely changing the translation from CMYK to RGB would be fairly simple.
    In this case, the usage is Ebay and they only accept JPG, PNG (and maybe BMP and GIF, I didn't look that closely), but require RGB. I was actually quite surprised to find that JPG allows CMYK since, as you say, anyone dealing with CMYK is going to be dealing with commercial printing and few people who deal with commercial printing would play around with JPG.
    I always stick to TIFF or PSD for workflow, but JPG is popular for a reason - when it comes to web, JPG is the only format that can deliver manageable file sizes with full-screen or "large" images for web. Our top level banner photo is 2590x692 and needs to be under 400kb for sane download speeds. PNG couldn't touch that. Even with the aforementioned 1800x1200, PNG is nearly 2mb, while I can maintain very decent quality with a 500kb file with JPG that works well for 'zoom in' type usage.
    So there's no way around JPG. It's just annoying that the first person to touch a random selection of the pics was primarily an Illustrator user and saved *some* of the pics in CMYK mode.
    It's like that old story about the farmer who didn't want anyone to steal his watermelons, so he cleverly posted a sign "None of these watermelons are poisoned", only to find a note the next day saying "Now, One of these watermelons is...".
    Far more work to fix 'some' of the images compared to just doing it right the first time.
    But then again, for workers like that, if you can't trust them with an easy job, you could hardly trust them with more complicated jobs...

  • Convert image from RGB to CMYK and back to RGB

    Hey.
    I wonder if anyone has experience with converting image from RGB to CMYK and back to RGB?
    I had a TIF in RGB then converted to CMYK but I figured that it might be better to keep in RGB, so I converted back. I read that it supposed to cause some loss in the data, but I can't see anything on the image, it is still very huge and the 2 RGB files has the same size as well. Is there a way to compare the resolution of 2 images somehow, or how can I see what I lost through the 2 conversions?
    Thanks for help

    I had a TIF in RGB then converted to CMYK but I figured that it might be better to keep in RGB, so I converted back.
    The original RGB data is not being restored by converting from the CMYK version, so the term "keep" seems inappropriate.
    What are the actual Color Spaces (ICC profiles) involved?
    Is there a way to compare the resolution of 2 images somehow, or how can I see what I lost through the 2 conversions?
    How did resolution come into this?
    To determine how large a portion of the image has been changed you could
    • make a flattened copy of the original image
    • place a flattened copy of the RGB->CMYK->RGB image on top of that and set it to Blend Mode Difference
    • add an Adjustment Layer (Curves for example) to brighten the image

  • How does the TIFF format compress images?

    When we choose "File> Save As" to save an image to a TIFF file, a TIFF Options dialogue box appears with 4 image compression options( None, LZW, Zip, Jpeg). What is this for? Does the TIFF format compress images? Are they destructive to the image quality? THANK YOU

    If you select no compression, it will take up too much space, guaranteed.  TIFF lets you pick any compression method supported by your program and the viewing program.  Some are lossy, some are lossless.  Most TIFFs tend to be compressed in LZW or ZIP, both of which are lossless.  You can also choose to compress your TIFF using JPEG compression, which is lossy, but I can't imagine why you would do this instead of simply saving as a JPEG file, which is more likely to be properly opened in browsers than a JPEG-compressed TIFF file.
    And in response to one of the previous posts, not all compression throws away details from your file.  Only lossy compression (e.g., JPEG, or in the music area MP3) throws away data.  The lossless compression techniques simply encode the data in fewer bits if possible.  (One important fact not relevant to the web, where you will use 8-bit-per-channel files:  If your photos are 16-bit-per-channel, don't save in LZW compressed format; they will actually become larger than the uncompressed image.)  For a simplified example, if there is a series of 16 pixels of solid white, a losslessly compressed image will have code that says, in effect, 16 pixels of (255,255,255) using an abbreviated code instead of simply listing (255,255,255) sixteen times.  It builds up a directory of byte combinations and can use just a few bytes to refer to many bytes of image data.  Because the coding and decoding is exact, there is no change in the image data when it's opened.
    JPEG is a lossy compression technique that doesn't actually record pixel values at all.  It uses formulas to specify averages and changes within regions.  In effect, it records the fact that a given group of pixels has values centered on X color, and that the upper left is much pinker and the lower right is much greener than the average.  When you pick the degree of quality for JPEG compression, you tell it how small to make the comparison cells.  As you can imagine, if the image has text, tree branches, or other highly contrasty subject matter, this will cause serious weirdness if the comparison cells aren't very small (i.e., you don't have the quality set to max).

  • Images become very compressed and grainy even when they are already compres

    Hi Everyone,
    This is my first time to the forum, Ive had a look here and around the internet but I havnt been able to find the solution.
    Below is a link to an image showing what I mean.
    http://s750.photobucket.com/albums/xx141/SRangott/?action=view&current=DVDGrab.p ng
    The image on the left is the finished dvd playing back. The image in the middle is a video file that is compressed through compressor using the highest quality setting and finally on the right is the original image.
    Ive tried setting up the pictures multiple ways. Originally I setup a slideshow, when I got the problem I tried converting the picture over to the correct aspect ratio in photoshop to no avail.
    I then tried recreating the slideshow in FCP and exporting again through compressor and exporting a uncompressed file for dvd studio to convert. Neither of these solutions improved the quality at all.
    Next I tried exporting the pictures through Adobe Premiere Pro cs4. This time I had more luck, there was almost no grain but it was incredibly soft and out of focus.
    Now my thoughts at this stage are that the image just doesnt lend itself to compression at all with the dark areas. The image was originally compressed a bit and I got the original file from the slr camera. Its resolution is 2000x3000 at 3.5mg. No difference at all between the small and large file either.
    Anyhelp would be greatly appreciated, im about ready to pull my hair out.
    Steve

    RGB is not a color space, it's a color model. Color spaces are sRGB, Adobe RGB, ProPhoto RGB etc.
    Since you're apparently not familiar with these concepts, you should work consistently in sRGB, which displays roughly right in all scenarios even in the absence of color management.
    The default color space out of Lightroom (if you haven't changed it) is ProPhoto, which can quickly get you into trouble unless you know what you're doing. Change it to sRGB in Lr Preferences > External editing.
    Don't change Photoshop color settings! That will quickly get you into an even bigger mess than you are now. Reset it to default settings and don't touch them again until you know more. What you need to change is Lightroom "Edit in Photoshop" color space.

  • Converting to .jpg to print (RGB vs.CMYK)

    Hi all,
    I am fairly new to adobe and all things it has to offer. I am slowly learning how to do everything myself.  I am currently using CS6. I made myself a 16x20" poster in Illustrator, converted it to a .jpg using the export menu. I put it to my flash drive and printed it out at a local fed ex office. When converting it to jpg, I kept it in CMYK color mode, and set it to be at the highest resolution and the highest quality file I could have.
    Now, I made another poster for a friend and did the exact same thing.  Instead of taking her .jpg somewhere to get printed, she is trying to upload it to a photo printing site (walmart, snapfish, shutterfly) to get it printed and mailed to her. Her poster keeps getting errors on the photo uploading site saying it is corrupted and not a valid file type.  I was confused, so I tried messing around with the illustrator file a bit, I ended up changing the color mode to RGB when I converted it to a jpg (I still made the artwork in CMYK mode). This uploaded fine to all the photo sharing sites, and was also half the size of the original .jpg (12 MB vs. 24).  So then I googled it, and came across a website that says printers only print in CMYK.  So if that is the case, what will happen when she prints this poster?  And why won't these photo uploading sites allow me to upload a poster that is in CMYK mode? If printers only print in CMYK, you would think it wouldn't be a problem.
    On a side note, when I try to upload the CMYK .jpg image to Fed Ex office online, it perfectly uploads.  So maybe this is just a problem with simple photo uploading sites?
    Thanks for the help!  Again, I am fairly new to illustrator so I don't understand color modes much or much else.

    I suggest you get your hands on Adobe's Print Publishing Guide.  I am sure there are many online "photo" print services out there.  The key is they are "photographic" printers which are RGB based.  It wouldn't surprise me if they incorprated some type of default rejection coordinance where they reject CMYK files.  You should be looking at PDF instead of JPEG anyway.  And, since that is a large format print job, a medium resolution based PDF is adequate and small enough to send FTP.  The advantage to PDF is it can honor a well established color workflow.  Focus on reading the various RGB color spaces and the different levels of PDF.  Also, spend some time on color management and converting from RGB to CMYK.  I'd be interested in learning which color settings and workspace profiles you have in place.

  • How to show a compressed image in the report?

    Hi
    I have created a new report.what i do in application is i  compress the image and save it in database.now i need to retrieve the compressed image and display in the report. I have used the following code to decompress the binary data save in the image.I
    dont know after that what should i do. Please help me to show the picture in SSRS Report. I need to show picture in many reports.one of my doubt is how to call this function in SSRS Report. The function accepts input as byte but in database the column in varbinary.
    should i convert the input type of function to varbinary instead of byte array? Please help me.
    Public Function Decompress(ByVal arr As Byte()) As Byte()
    Dim notCompressed As Boolean
    notCompressed = False
    Dim MS As MemoryStream
    MS = New MemoryStream()
    MS.Write(arr, 0, arr.Length)
    MS.Position = 0
    Dim stream As GZipStream
    stream = New GZipStream(MS, CompressionMode.Decompress)
    Dim temp As MemoryStream
    temp = New MemoryStream()
    Dim buffer As Byte() = New Byte(4096) {}
    While (True)
    Try
    Dim read As Integer
    read = stream.Read(buffer, 0, buffer.Length)
    If (read <= 0) Then
    Exit While
    Else
    temp.Write(buffer, 0, buffer.Length)
    End If
    Catch ex As Exception
    notCompressed = True
    Exit While
    End Try
    End While
    If (notCompressed = True) Then
    stream.Close()
    Return temp.ToArray()
    Else
    Return temp.ToArray()
    End If
    End Function
    Thanks & Regards Manoj

    Please try this 
    Public Function Decompress(ByVal arr As Byte()) As Byte()
            Dim s As Byte()
            Dim notCompressed As Boolean
            notCompressed = False
            Dim MS As System.IO.MemoryStream
            MS = New System.IO.MemoryStream()
            MS.Write(arr, 0, arr.Length)
            MS.Position = 0
            Dim stream As System.IO.Compression.GZipStream
            stream = New System.IO.Compression.GZipStream(MS, System.IO.Compression.CompressionMode.Decompress)
            Dim temp As System.IO.MemoryStream
            temp = New System.IO.MemoryStream()
            Dim buffer As Byte() = New Byte(4096) {}
            While (True)
                Try
                    Dim read As Integer
                    read = stream.Read(buffer, 0, buffer.Length)
                    If (read <= 0) Then
                        Exit While
                    Else
                        temp.Write(buffer, 0, buffer.Length)
                    End If
                Catch ex As Exception
                    notCompressed = True
                    Exit While
                End Try
            End While
            If (notCompressed = True) Then
                stream.Close()
                Return temp.ToArray()
            Else
                Return temp.ToArray()
            End If
        End Function
    Thanks & Regards Manoj

  • 'Convert CMYK Colors to RGB' still runs havoc in 9! (Plus a PDF version problem)

    This post is to warn people about severe issues, and how to avoid them. Issues with the CMYK color setting in FM9.x have been reported here earlier, such as:
    http://forums.adobe.com/message/1237696#1237696
    http://forums.adobe.com/message/1237852#1237852
    http://forums.adobe.com/message/1237165#1237165
    However, I do not think this issue has been warned about anywhere near as much as it should have. And, as usual, Adobe is silent (they should have a big poster on their site warning about this issue! And they have even claimed that patches have "solved" the issues with CMYK).
    Just recently, while experimenting with FM9 again, I had extreme problems, which, at first, seemed totally unrelated to this CMYK setting. But after having struggled extremely hard for many many many hours, I finally found out. Now is the time to inform others:
    First a note about versions: FrameMaker 9.0p237, Acrobat Distiller 9.1, XP SP2
    It looks perfectly okay on screen in FrameMaker, exactly as in FM8. But when saved as pdf, several things are "corrupted". Examples: no kerning after the letter 'T', such as the word 'Text'. Dotted leader for a right aligned tab disappears. Some objects from the master pages, such as a logo, become enclosed in a rectangle (a border of the frame/object), but it only happens on *some* body pages, whereas other body pages using the same master page are ok!!? Equations are formatted differently from the way they should, with the wrong font for number, etcetera.
    Solutions:
    1. When 'Save as PDF...', untick 'Convert CMYK Colors to RGB' in PDF Setup. Same setting is in the file's 'Format > Document > PDF Setup...'
    A drawback with this method is that, as of Acrobat Distiller v9, it does not seem to respect the pdf version specified in the PDF job Options! I get PDF 1.6 with this method, despite my job option specifies version 1.5. (This happens also with FrameMaker 8 if Acrobat is v9.) So you *have* to optimize it in Acrobat in order to get a web friendly PDF (PDF 1.4 or 1.5).
    or
    2. Print to 'Adobe PDF'.
    In this latter case, you can set the same 'PDF Setup' settings under the button 'Setup...', EXCEPT that there is no tick box for 'Convert CMYK Colors to RGB', and it does not matter what setting you have chosen in the file's 'Format > Document > PDF Setup...', it will be RGB conversion in any case. Make sure that after you exit the setting, the tick box for 'Print to File' is NOT ticked! This method respects the pdf version specified in the PDF job Options! I get PDF 1.5, which is what my job option specifies.
    (For some reason, Acrobat/Reader does not render these two PDFs exactly the same, except in extreme magnification! Maybe it has to do with the different PDF versions of the files.)
    In either case, the solution actually solves ALL problems I listed! Despite it seems to have absolutely nothing whatsoever to do with colors! Some day in the distant future, CMYK might actually work! But, for myself, I would prefer a proper color management instead...
    Best Regards,
      /Harald

    Oops!! Not until now I discover that under 'Solutions' I happened to write 'untick' where it should be 'tick'! I.e, colors SHOULD be converted to RGB in order to circumvent the problems! I.e it runs havoc in v9 when CMYK colors are NOT converted to RGB! Don't know how I came to write the opposite, but probably I started out by describing the situation where the problems are seen rather than describing how to avoid them.
    Equally strange is that nobody corrected me, but perhaps the mistake was so obvious? (But whether you see problems or not might depend on what fonts you use. So, under certain special circumstances, CMYK might actually work without these reported problems.)
    I am also a bit surprised that others haven't reported the issue that the PDF version set in PDF job Options isn't respected when using 'Save As PDF' and Acrobat 9? (Or maybe someone has, but I have missed it.)

  • Convert CMYK to RGB for MS Word?

    Greetings! I've designed a logo for a client using Illustrator CS6. There is the 4-color version in CMYK .eps as well as 1-color, 2-color, and KO versions. Everything looks and acts as it should and will no doubt be perfect for offset printing (my main area of experience). However, once delivered to the client they were anxious to put them into use and immediately dropped the 4-color version into a word document and made a pdf for email distribution. When I received it I had to groan, the colors had shifted to the obscene.
    My guess is that what the client needs is a set of the logos that are converted to RGB. I'm also thinking that since the logos might be re-sized for various uses, keeping the art in the .eps format (as opposed to a raster format) makes sense. Is that true?
    And,
    Is there an easy way to convert the original CMYK eps files to RGB within Illustrator?
    I'm wide open to suggestions for best practices regarding artwork for use in MS Office applications.
    Thanks!
    Tim

    Since you're already familiar with a print workflow, your profiles are probably correct for this conversion. The only caveat would be how Word deals with color. I don't use Word, so I have no idea about that. Best practice would be to learn how your client is going to use the files you supply, and test each application.

  • A Fast way to display compressed images?

    Hi,
    I currently working on iPhone and trying to display (home-made) compressed images in an UIImageView : it is updated as soon as I have finished building the new one. I already do it with raw (BMP) images but I use them at 2D GLTextures that I found faster than the use of an UIImageView.
    To update the view with compressed images, I do:
    //member in .h
    UIImage * myImage;
    UIImageView * MyImgView;
    // In .m
    -(void)UpdateImageWithData :(NSData *) p_Data
    myImage = [UIImage imageWithData:p_Data];
    MyImgView.image = myImage;
    This works quite well, but I encounter a major drawback for me : the frame rate of this is never better than 10 fps. I build my images faster that 25 per second, but cannot display them that fast.
    I tried to change compression quality and compression methods (PNG interlaced or not, JPEG (411, 421, 444, varying quality from 10 to 100%), etc.) but I always have the same frame rate. So, I am assuming that the max frame rate you can have with an UIImageView is limiter whatever the format is.
    Now, I am wondering a few things :
    - Am I right about this limitation or do you see any flaw in my discussion?
    - Is there some way to 'accelerate' the rendering with an UIMageView?
    - Is there another faster way to display compressed images (or at least any kind of JPEG images)
    - Is there a (fast) way with UIKit (or any compatible lib) to retrieve the raw image so that I can use my first method and display it as a 2D OpenGL Texture?
    - Since from one image to the other only a few changes occur, do you see any way to update only what actually changed in order to save some CPU?
    - Do you think that the problem about UIImageView frame refreshement rate is linked with the iPhone Video Processor or with its CPU? (thus the new 3GS may help me solve this problem)
    Thank your for reading this untill the end.

    Hey, guess what, I had pretty much this same exact problem. Client wanted full screen 30 fps animation. Here's what I found experimenting with full screen sizes:
    - Whether you use UIImageView conveniences, or load and draw yourself in a UIView subclass, makes no apparent difference.
    - If you're doing basic Quartz drawing, never a problem keeping 30 fps up.
    - But as soon as you change the image in a UIImageView, or draw it with CGContextDrawImage() yourself in a UIView, then the frame rate plummets to about 10 fps on an iPod touch 1G, or 20-25 on an iPhone 3GS.
    For my purposes most of the full screen animation could be put into movies, and the motion clipped down to manageable sections in the interactive portions (and anyway, the fps doesn't really matter for those background bits). If it's not for you, then I guess you need to go down to OpenGL and see how that works out.

  • How to compress image size?

    Hi,
    Is there any way to compress image size in iphone? Actually my application is uploding images to server from phone. It takes long time to upload the original image. So if I can compress or convert to thumbnail, it'll help me out.
    thanks

    I got the answer use UIImageJPEGRepresentation(image, compressionQuality) to compress the image.

  • Tiff image with JPEG compression

    How does photoshop handle RGB and YCbCr as photometric interpretations of tiff image with JPEG compression?
    Are they same?

    Got no idea but here is a website with a adobe pdf answer.
    http://www.ask.com/web?q=How+does+photoshop+handle+RGB+and+YCbCr+as+photometric+interpreta tions+of+tiff+image+with+JPEG+compression%3F&search=&qsrc=0&o=0&l=dir

  • How to compress images to video?

    Hi All,
    I generate 15 images every second, and I want to make it into a video
    stream and send it to someone else through network.
    To elaborate: I have a Frame window and I want to show the other person
    what is happening on the window. So I capure image of window 15 times
    in a second and want to convert to video stream, send to other person, and the
    want the other person to view the video.
    Can someone give me an idea how can I achieve this..
    Thanks,
    Shrish
    PS: There is "video compression manager" in windows API to compress image
    data for use in an AVI file
    (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_video_compression_manager.asp)
    Is there something similar in java?

    I don't know what is an API key.
    However in the context of visual Net you can create very simple a thumbnail.
    Be aware this method seems to be to extract a thumbnail. But it is not, it simply creates one.
    https://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage(v=vs.110).aspx
    Success
    Cor

  • Color correct CMYK Image with RGB Image

    1. anybody please tell me is it possible to perform color correction in CMYK image with RGB reference image
    2. how to do that i mean what are the details i have to watch for?
    ADVANCE THANKS

    Your match using my color profile(similar to North American General Purpose) would be 29c 100m 83y 35k. Convert a sample swatch, using your color workflow/profile.
    Some RGB colors won't convert well to cmyk (eg 0R 255B 0G). In that case your problem is not using a RGB reference image for CMYK color correction, but the cropped color gamut in the color conversion itself.
    In those cases of saturated RGB colors you may have to do some handtoning to surrounding colors, to help create the illusion of RGB saturation to the troublesome color you are matching.

Maybe you are looking for