Grayscale to RGB

Hello,
I am trying to convert a grayscale image (pixelBits = 8 numComponents = 1) to an rgb image (pixelBits = 24 numComponents = 3).
There are many tutorials to convert RBG to grayscale but not the opposite...
Any idea ?
Thanks.

Hi Yann,
Thanks for your useful post.
Unfortunately there's still little defect : result operation colormodel is not explicitly specified, which leads to strange background rendering when using backgroundValues parameter in "rotate" operation.
So here the enhanced code :
PlanarImage src = JAI.create("fileload", "Photo.jpg";);
System.out.println(src.getColorModel());
// Prepare operation parameters
double[][] matrix = {
     { 1.0D, 0.0D },
     { 1.0D, 0.0D },
     { 1.0D, 0.0D } };
ParameterBlock pb = new ParameterBlock();
pb.addSource(src);
pb.add(matrix);
// Prepare rendering hints
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
ColorModel cm = RasterFactory.createComponentColorModel(
     DataBuffer.TYPE_BYTE, cs, false, false,
     Transparency.OPAQUE);
SampleModel sm = cm.createCompatibleSampleModel(image.getWidth(), image.getHeight());
ImageLayout imageLayout = new ImageLayout();
imageLayout.setSampleModel(sm);
imageLayout.setColorModel(cm);
RenderingHints renderingHints = new RenderingHints(null);
renderingHints.clear();
renderingHints.put(JAI.KEY_IMAGE_LAYOUT, imageLayout);
// Perform the band combine operation.
PlanarImage dst = (PlanarImage)JAI.create("bandcombine", pb, renderingHints);
System.out.println(dst .getColorModel());

Similar Messages

  • Converting Grayscale To RGB

    I am trying to add some B&W photos that I scanned. In a previous post I was advised to convert any grayscale pix to RGB. Is there a way to convert using os x 10.3.9? I think I figured it out in photoshop. When I open the pic in preview and select "get info" the profile reads "sRGB IEC61966-2.1". Is that ok? Someone please help lol. Thanks in advance.

    Yes the sRGB profile is fine.
    Regards
    TD

  • Grayscale to RGB Confusion

    Hi guys, please try this:
    1) new image, grayscale
    2) fill (say 96,96,96)
    3) image->mode->rgb color
    The pixels will be (95,95,95) and (96,96,96) when they should *all* be the same.
    It also happens when you paste a black & white image into an RGB document because even though it has three 8-bit channels (by definition not grayscale) Photoshop decides to make it grayscale.
    Is there a way to correct this ?
    Thanks.

    Hi,
    My Color Settings are set to Monitor Color, and the Proof Setup is set to Monitor RGB.
    I don't see any settings for dithering.
    When I say Black & White (as opposed to Grayscale) I mean a 24-bit RGB image that has only gray (R=G=B) pixels. If I paste that into an RGB document I get pixels that are not consistent, if I paste it into a grayscale document the pixels are consistent but become inconsistent when I convert that document to RGB.
    What should I do ?
    Thanks for trying to help.

  • How to export grayscale (not RGB) from LR3

    I am processing hundreds of scanned B&W negatives and want to work on them in Lightroom. However, grayscale is not an option in 'export', so I have to export as RGB (@ 3 times the size), then open them in Photoshop, and change them back to grayscale - a crazy convoluted workflow!
    Am I missing something, or is there really no way to export grayscale out of Lightroom?

    I would like to find a plausible explanation as to why a color scan of a monochrome original is better than a monochrome scan. It is a thoroughly established law of physics that the information content of a fully predictable signal is zero. What I mean is that if the R, G and B channels of the monochrome are identical, then “upgrading” from a single-channel scan to a three-channel scan produces perfectly predictable results (two additional channels, identical to the first one) and NO new information. But what if the R, G and B channels of the monochrome are not identical? What is the cause and source of this difference?
    Assumption 1: all sub-pixels (RGB) of the scanning head are co-located (scan precisely the same spot of the original). In this case any difference between the color channels is simply processing errors (nonlinearities, inter-channel differences in calibration), and a 3-channel scan produces no new information over a 1-channel scan.
    Assumption 2: the three sub-pixels are slightly offset to each other. In this case each channel scans a slightly different set of spots from the original, and combination of the three channels might produce additional information (extra resolution, if the channels are properly combined).
    Further along this line of thought: I guess assumption 2 is correct and the three sub-pixels are slightly offset to each other. Perhaps all scanners are designed to work with color originals and the conversion to monochrome in the scanner is less than optimal, and should be done in post-processing rather than in the scanner? Another line of thought: even if the original and its digital representation are monochrome, we are using three-color monitors to view monochrome images. Operating systems use technologies (eg Microsoft’s Crystal View) that use the three-color sub-pixels to antialias black-and-white text. Because humans’ visual acuity for color is much lower than the acuity for monochrome, the colored sub-pixels used for antialiasing are not normally perceived as colored blotches but rather as smoother gradations in grayscale. Along this line of thought, it might be possible that a three-color version of a monochrome image produces smoother gradations of tone than a monochrome version of the same image does, when viewed on a three-color monitor.
    Just speculating, of course, in absence of solid knowledge.
    Antero

  • Acrobat grayscale images editied in photoshop convert to rgb when brought back into the pdf file.

    After I edit a photo using the object touch up tool in photoshop CS6 and bring it back into acrobat as a grayscale halftone all works fine till I print. It prints on multiple plates. When I edit it again in photoshop the halftone has turned into RGB. It happens every time. I assume there is a color setting in acrobat that is doing the conversion from grayscale to RGB but I don't know where to look. This has worked fine for years and has only recently stopped working. By the way I'm using acrobat pro.

    It's really necessary to know by which program you had created the PDF.
    Here comes a test PDF for questions like yours, created by InDesign:
    http://docs-hoffmann.de/riptest05072013.pdf
    Different images:
    sRGB, pRGB=ProphotoRGB, CMYK , all with individually embedded profile,
    Grayscales: without embedded profiles, because InDesign doesn't embed gray profiles,
    Lab: without profile, because Lab is automatically detected and not ambiguuos.
    Of course, using so many different images in one PDF is useful only for tests.
    An actual test:
    Touch Up Object Grayscale and edit in Photoshop. There is no embedded profile
    but the image is in PS detected as Grayscale. One has to assign a profile.
    Re-imported in the doc, it is a Grayscale JPEG*, before it was a Grayscale ZIP.
    In Acrobat 8 one can check the actual content of a PDF by
    Advanced > Print Production > Preflight
    In newer versions this is still available but somewhere else.
    I'm using version 8, because I uninstalled X on purpose.
    Best regards --Gernot Hoffmann
    *Edited:
    As far as I remember, there is no special code for Grayscale JPEGs, it's just a JPEG
    with zeros in the Cb Cr channels ... like an R=G=B gray image.

  • Convertir une image "Grayscale I16" en "RGB U64"

    Bonjour,
    je cherche depuis un petit moment sur tous les forums que je connais, et je ne trouve pas de réponse à mon besoin, à savoir convertir une image en niveaux de gris de 16 bits en RGB 64 bits. J'ai réussi à le faire en 32 bits, mais la dégradation est trop importante pour mes besoins.
    Si vous avez une solution, je vous en serais reconnaissant.
    Si ça peut vous aider, j'ai Labview 8.6 et NI Vision.
    Merci d'avance

    Si vous souhaitez, voici le VI que j'essaye de faire. 
    Il marche très bien en grayscale 8bits => RGB 32 bits, mais pas en Grayscale 16 bits => RGB 64 bits...
    J'ai supprimé tout le traitement que j'effectue sur l'image pour que ce soit plus lisible. Comme j'effectue divers traitement suivant la couche de l'image (R,G,B), je suis obligé de passer par un Imaq ReplaceColorPlane. 
    Merci du temps que vous consacrez à mon problème.
    Pièces jointes :
    tests.zip ‏217 KB

  • Save for Web... and grayscale images

    I noticed a strange behavior when I use "Save for Web and Devices" on scanned BW negatives...
    I import the negatives via the scanner's twain driver in Photoshop as 16bit grayscale images. My grayscale working space is normally set to the default DotGain 20% profile. When I want to show these images on the web, I use "Save for Web and Devices..." and I have selected the convert to sRGB option. For some reason, the "embed color profile" option is disabled (grayed out) when the document is in grayscale mode.
    When I view the the exported image (in a color managed application or browser) it looks too dark and shadow detail is lost. Examining the file info shows that the JPG file is in RGB color space and has the sRGB profile assigned.
    When I convert the image to RGB mode before I do save for web... the exported image will look exactly like it looked in Photoshop. Also, the mode change doesn't cause a change in appearance. Also, after changing to RGB, the "embed color profile" option in save for web... becomes enabled.
    I experimented with other working color spaces and noticed that an image exported from a grayscale image in "GrayGamma 2.2" working color space will display almost like an image that was exported from a grayscale image converted to RGB.
    I would like to understand this behavior and whether it is correct. My assumption would be that a conversion to sRGB during the export should yield the same result like a manual conversion of the image in photoshop but for some reason the results are quite different.
    How can I export my grayscale images to sRGB JPG without having to convert to RGB manually while preserving the tonality from the original image?
    I have attached an image which I hope might illustrate the effect I'm describing. The crop on left hand side looks as expected and is the result of exporting from an image that was converted from grayscale to RGB mode (sRGB working space) before using save for web...
    The image in the middle is the result from converting to GrayGamma 2.2 color space but leaving the image in grayscale mode before saving for web and devices. It is almost identical to the crop on the left. The crop on the right hand side is the result of using save for web and devices from the original image in grayscale mode with the default DotGain 20% profile.
    Thanks
    /lars

    These are my settings. Are they the same in your SFW dialog?

  • I can change from grayscale slider to hsb slider

    I did a grid in photoshop using a tutorial in this website http://www.webdesign.org/web/photoshop/textures-&-patterns/grid.3792.html and I got it, but now a want to to a boder for each grid but the Grayscale slider prevails and all of the others sliders are off. I go to the color palette and click at the top right of the palette and a menu appears the with options like grayscale sliders, RGB Sliders, HSB slider, CMYK Sliders, Lab sliders, and HTML sliders the online one on is the Grayscale sliders after that all of them are off
    The layer menu is off completely, and some other features in the photoshop cs3, and when I go and save the file the GIF, JEGP and all other common formats are off, I can't save the file on those formats because psp, photoshop pdf and other that I am not interested on. I want gif, jegp etc.
    I have just realize that when I created a new documents I might put it in the grayscale mode only.
    What do you think about it guys I want to be able to apply boders and save it in gif, jepg and other common format

    There aren't many reasons why you would start out with a grayscale document, even if you want only a grayscale image because RGB gives you more control so make sure that Color Mode is RGB Color

  • Form wizard cannot detect fields

    I designed a form in InDesign CS4 and saved it as a high resolution PDF file. I open the PDF file in Acrobat 9 Pro and go to Forms > Start Form Wizard, select the current document and get the error message: "No new form field annotations were detected."
    I have created forms this way in the past and this is the first time this process hasn't worked for me. Any suggestions on what could be causing the problem? (Do I need to export the PDF a particular way or something else?)

    Exporting from InDesign with printer: Adobe PDF and PPD: Adobe PDF 9.0
    Paper: Letter
    Crops: Off
    Output Color Settings: I have tried Composite Grayscale, CMYK, RGB and Separations (Black)
    Graphics: All
    Fonts: Complete
    PDF Default settings: I have tried Standard, High Resolution Print, PDF/X-1a:2001, Press Quality, Smallest File Size, Standard
    For example, I have tried combinations such as exporting as black separations with the Press Quality setting or as a Composite CMYK image with the PDF/X-1a:2001 setting.

  • Help with Photomerge and how to do suggested solutions

    I am using Photoshop CS3 on Windows XP and am having a problem with Photomerge working very slow, not working at all, and not being able to handle more than 2 photos (sometimes it won't even do 2 that have 25% overlap). I found these solutions in a previous thread.
    Solution 2: Increase the amount of scratch disk space available to Photomerge.
    Solution 3: Decrease the size of the source files.
    Solution 4: Reduce the amount of RAM allocated to Photoshop in the Memory & Image Cache Preference to approximately 40-50% and retry.
    Can someone tell me if these solutions are correct? If so, how can I do these? If not, what can I try? If I could get detailed instructions (I don't know anything about computers) that would be the best. Thanks in advance for any help!

    I have often scanned LP album covers in segments, at 600 ppi, and used Photomerge to meld them together. That results in images that are roughly 7200x7200 pixels, or 50 megapixels. Photomerge is pretty quick, given the size of the files.
    But yeah, you may need to reduce the resolution of the files you are scanning. You may be scanning at 1200 ppi or higher. For text, I don't think I'd go much below 600 ppi if you want a really clear reproduction, and scan in grayscale or RGB, not the "text" mode, which is 1-bit bitmap and will not likely work well with Photomerge. Turn all descreening or sharpening options off in the scanning software; likewise, turn off all exposure wizards and expose all images at the base manual settings (don't use the scanner software's curves, etc.). You will take care of the exposure, sharpening, descreening, etc. in PS once you have scanned and merged.

  • Change color of scanned line art

    I'm want to scan a line art of a leaf, make the white background transparent, and change the black lines to red. I can scan the art to Photoshop, get rid of the white background, but I can't change the black lines to red. After scanning, the background layer is locked and won't allow editing.I tried scanning as a bitmap, b&w scalable, 16 color, etc. Nothing works.

    Image > mode > grayscale, then image > mode > RGB. Then create a solid fill layer layer > new fill layer > solid color. Pick your color and set that layer's blend mode to screen.
    Not sure how you're deleting the background, while keeping the leaf on the background layer. But if you make it a grayscale or RGB image, you should be able to convert the background layer by going to layer > new > layer from background.
    If you do manage to get the layer off the background you can clip the solid fill layer to the leaf layer by having the solid fill layer active and pressing ctrl-alt-g, or by alt-clicking the space between the two layers in the layers panel (you'll see you cursor change).

  • Halftone or Line art figure

    Is it possible to find whether a figure is Halftone or Line art using scripting.
    thanks,         
    Sashi

    Are you referring to the documentMode bitmap (1bit depth) as opposed to grayscale/rgb or do you mean checking whether any pixels in a grayscale- or rgb-image have values other than 0 or 256?
    In first case a simple if-clause works:
    if (app.activeDocument.mode == "DocumentMode.BITMAP") {
      alert ("bitmap")
    else {
      alert ("not bitmap")
    In second case you might use the histogram.
    Though your use of the term »figure« seems a bit odd to me – are you talking about an image or part of an image?

  • In the Info panel, how do I display pixel values as values, not as percentages?

    I'm trying to show, using the eye dropper tool, the actual values of pixels in an 8-bit grayscale image (Mode command confirms that's what's there). In the Info panel, the eye dropper tool displays percentages for every type of color information (K, CMYK), while the "8-bit" field remains blank.
    I've looked at Properties and pretty much everything else that I can find with no luck.
    Photoshop CS6, 64 bit, Win7-64
    Thanks!
    Ian J.

    Ian Jaffray wrote:
    Noel,
    Thanks for your reply. I thought this had been fixed by recreating the Preferences file, but this morning I was back to percentages. I did have different settings in the Info Panel from the ones in your very helpful picture, and after I changed mine to match yours I now see 0-255 values in the R, G, B settings when using the eyedropper on this grayscale image.
    Instead of RGB Color for the First Color Readout I had "Actual Color". This by itself causes percentages to be displayed. All options for the Second Color Readout all seem to produce percentages.
    "Actual Color" is what I normally use for the first readout. In the case of a Grayscale document, it will display a K (black) value. For a RGB image, it will display R,G and B values. And so on.
    When 8-bit is chosen for the value format, we expect a value of 0..255 to be displayed. As you know, that works fine for the RGB readout, but a Grayscale readout displays a percentage instead.
    So if you set one of the readouts to RGB and 8-bit, you can get 0..255 values to be displayed for your Grayscale document.
    When the document is Grayscale, the RGB values are a conversion from the document colour space to the RGB working space as defined in Edit > Color Settings. To get the true values of the pixels, the Grayscale document profile and RGB working space must be complementary (for lack of a better word). That's why, in my first reply, I said to use the following combinations:
    Doc with sGray profile and RGB working space of sRGB.
    Doc with Gray Gamma 2.2 profile and RGB working space of Adobe RGB.

  • Photoshop Black and White profile for printing

    I'm a black and white photographer, so this issue is extremely important for me to resolve. I've been looking online and I have yet to find the answer, so I hope someone can help.
    I need to know how to set up the black and White profiles in Photoshop for printing. The printer I have is a canon Pixma Pro 9000 a mark II
    I need true black and white. Thank you in advance for any help or suggestions. If you need me to provide additional information let me know.

    I frequently print black & white work on an Epson, using the Advanced black & white feature in the print driver.
    A quick internet search found that there is something similar for Canon -  Canon : PIXMA Manuals : Digital Photo Printing Guide : Black and White Printing
    I print scanned grayscale files, and have the grayscale profile in PS set to Gamma 2.2.
    If you are printing digital photos, they will be RGB, but that will probably not make any difference. But you have to read the documentation for the Canon to find out if it will. IOW - if the image should be Grayscale or RGB.
    One very important thing when printing like this is to set the printer to manage colors (not PS) in the PS Print dialog.

  • I am cutting a graphic and pasting it into another photoshop file, it is in color when I cut..

    ..but pastes in black and white.  What am I doing wrong?

    You are most likely pasting into a grayscale document. Check at the top of your window of your target document to see whether it says "Grayscale" or "RGB."
    It's less likely, but you might also have a single channel selected on your channels palette while previewing RGB.

Maybe you are looking for

  • How to find the objects in an application

    Hi We are trying to increase the performace of our server During testing we observed that the memory usage is increasing , we wanted to know what are the objects are created at any time Is there any way to do this , and are there any opensource tools

  • Transitions not sticking to images

    Im trying to link two photos with a trasition (page peel to be exact) but for some reason, they're not taking it. It's as if there's a blank space between them, so the transition only sticks to one of the photos and the blank space. This has been hap

  • Using iPod to transfer music to separate PC

    I want to use my ipod to transfer music from my hardrive onto my daughters PC (which has no internet access). Sounds simple but I can not seem to do. Any ideas?   Windows XP Pro  

  • Forex rate in PO and OB08

    Hi When doing PO (Import items) the user is manually entering the exchange rate for EURO, say as 47.85 (Exch. Rate fixed check box ticked). MIGO and MIRO done at this rate. Vendor GL in FBL1N is showing figures according to this rate. But when user w

  • 4-up printing: make back side of sheet right?

    i would like to print 4-up and have the right page in the right place on the reverse side of sheet. That is: i want to print (say) acrobat documents 1,3,5 &7 on the front side, and have doc 2 on reverse of doc 1 (ie directly behind doc 1 on the rever