How to save greyscale image as jpeg?

Anyone know how to save a greyscale image as a jpeg in labview?

Hi Jonathan,
If I understand you correctly, you had a greyscaled image, which you applied color to and now want to save this new image.  Before I jump into possibly solutions, I have a question for you. 
Are you using any IMAQ, Motion, or Vision VIs?  If not, try using the Picture Control VIs - specifically, the "Write JPEG File.VI"
If that won't work, please post a small piece of code illustrating the issue.
Thanks!
Janell Rodriguez | Applications Engineer | National Instruments

Similar Messages

  • How to save multiple images from jpeg to psd?

    I'm pretty new at this and have tons of vacation photos. Things I've read have left me terrified of leaving my images in jpeg, but I don't know how to save them all to .psd (and is that really the format I want to use?). I tried, and suddenly I'm out of space on my harddrive, so I think I've made copies of copies and have way more saved than I need. Any advice is appreciated - thanks.

    <[email protected]> wrote<br />> ...Things I've read have left me terrified of leaving my images in jpeg...<br /><br />Andrea,<br /><br />If the JPEG files are straight out of your camera, there is no harm in <br />"leaving" them as-is...  they don't degrade from just sitting there.<br /><br />The possible degradation of JPEG files comes from saving as a JPEG - <br />typically after you have done an edit to the image.<br /><br />One good way to approach the issue:  when you open an image for editing, <br />before you do anything, click the menu File > Save As...  and then choose <br />the PSD file type.  This will make a copy for you to work with, which will <br />NOT degrade as you save, re-edit, re-save, etc.  After you're finished <br />working it over, if you need a JPEG copy, use the File > Save As...  and <br />select JPEG to make an edited copy in the smaller file format.  (File > Save <br />For Web is also useful for this - it allows you to set your quality and size <br />parameters on-the-fly as you save)<br /><br />HTH,<br /><br />Byron

  • How to save an image as PDF?

    Hi,
    I need help o how to save an Image as PDF file?? is this possible?

    Under Getting Started in the welcome window click Create PDF
    Open your image
    File>Save As...PDF
    But I am finding that there are limitations on how big the image can be. I am trying to save a 20mb jpeg to pdf in acrobat and having issues. Good luck!

  • How to save the image in the form?

    As thread, how to save the image into a file from the pdf form - image box?
    I have Adobe Acrobat 9 Pro extended.

    Hi Sandy,
    Sorry for Delay.Could you please provide script code for the Button and in which event we want to add the code
    I want to Save the lot of images in the PDF. For that I kept Image field in the form.Here I am able to upload the images but those are not saved.
    If possible please share the details document.
    Please help me.
    Thanks,
    Ravi.

  • How to save an image as a PICT resource file?

    Can someone tell me how to save an image as a PICT resource file? I'd like to make ikons in Photoshop and save them in this format, but I 'm not finding any leads. Thanks!

    If you have Resorcerer from "ancient times" it of course can handle resource forks since that's was it's goal in life.
    There are lots of icon creation apps these days.  Do a search for "icon" on macupdate.com to see what's available.  For example that search finds:
    iconXprit
    Icon Builder X

  • How to save an image to database and retreive from it.

    how to save an image retreived from an bytearray to database and retreive back the image from database....pls specify the steps and the query.

    You can use the JDBC API for database connectivity and you can use SQL to query the database.
    JDBC tutorial: http://www.google.com/search?q=jdbc+tutorial+site:sun.com
    SQL tutorial: http://www.google.com/search?q=sql+tutorial+site:w3schools.com

  • How to save an image as a jpeg

    If i have an image now
    Image finalImg = toolkit.createImage(source);
    How can i save it as a jpeg?
    A friend told me to use use classes from com.sun.image.codec.jpeg
    because i am very new to Java, i do not quite understand this codec.jpeg, please help

    That's ancient, use package javax.imageio -- I little dab'll do yah.
    import java.awt.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import java.io.*;
    import javax.imageio.*;
    public class HelloJPEG {
        static final boolean ANTIALIASING = true;
        static final boolean FRACTION_METRICS = false;
        static final int SIZE = 96;
        public static void main(String[] args) throws IOException {
            String text = args.length > 0 ? args[0] : "Hello, World";
            Font font = new Font("Lucida Bright", Font.PLAIN, SIZE);
            FontRenderContext frc = new FontRenderContext(null, ANTIALIASING, FRACTION_METRICS);
            Rectangle2D bounds = font.getStringBounds(text, frc);
            int w = (int) Math.ceil(bounds.getWidth());
            int h = (int) Math.ceil(bounds.getHeight());
            BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
            Graphics2D g = image.createGraphics();
            g.setFont(font);
            Object taHint = ANTIALIASING ?
                RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF;
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, taHint);
            Object fmHint = FRACTION_METRICS ?
                RenderingHints.VALUE_FRACTIONALMETRICS_ON : RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
            g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, fmHint);
            g.setColor(Color.GREEN); //for St. Paddy
            g.drawString(text, -(float) bounds.getX(), - (float) bounds.getY());
            g.dispose();
            ImageIO.write(image, "jpeg", new File("hello.jpg"));
    }A good source of all things Java2D is Chet Haase: http://weblogs.java.net/blog/chet/

  • How to save an image from canvas to jpeg2000 format?

    good day! i would like some help about jj2000. i wish to save an image from canvas to a jpeg2000 format file. how will i do it using the jj2000? i just need to save it to a file.
    please help!!!
    thank you in advance!
    lrds

    I am not familiar with Jpeg2000, but the easiest way I've found to go from Java to a JPeg file is with Java Adavanced Imaging (JAI) package from Sun. Take a look at it and see if it meets your requirements.

  • How to save in GIF or JPEG format?

    I make a drawing using Graphics objects and now i want to save it to a GIF or JPEG or BMP file.
    How to go about it?
    TIA
    Naveen

    Hi,
    Here is some code that may help.
    NOTES: pixels were recieved from a PixelGrabber proccess.
    transColor was picked from an image (you can supply your own code its just an int).
    blnTrans is a boolean flag indicating that a transparaent color was picked.
    dim is the dimensions of the image (any image will do).
    import javax.swing.*;
    import javax.media.jai.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.io.*;
    import com.sun.image.codec.jpeg.*;
    import com.sun.media.jai.codec.ImageCodec;
    import com.sun.media.jai.codec.ImageEncoder;
    import com.sun.media.jai.codec.PNGEncodeParam;
    import com.sun.media.jai.codec.BMPEncodeParam;
    import com.sun.media.jai.codec.TIFFEncodeParam;
    import java.awt.image.*;
    import java.awt.color.*;
    import Acme.JPM.Encoders.*;
    //Some more Code
    int fileType = 0;
    File file = null;
    if (pixels != null)
    //create a file save dialog.
    //create a File Chooser.
    fc = new JFileChooser(););
    int returnValue = fc.showSaveDialog(this);
    //detemine the choose.
    if (returnValue == JFileChooser.APPROVE_OPTION)
    file = fc.getSelectedFile();
    //get the file ext and translate for switch.
    Utils ut = new Utils();
    String ext = ut.getExtension(file);
    if (ext.equals("gif"))
    fileType = 0;
    else if (ext.equals("jpg"))
    fileType = 1;
    else if (ext.equals("png"))
    fileType = 2;
    else if (ext.equals("tif"))
    fileType = 3;
    else if (ext.equals("bmp"))
    fileType = 4;
    switch (fileType)
    case 0:
    if (blnTrans)
    NewImageProducer img = new NewImageProducer(pixels, TransColor, dim);
    try
    FileOutputStream fos1 = new FileOutputStream(file);
    Acme.JPM.Encoders.ImageEncoder e = new GifEncoder(img, fos1);
    e.encode();
    fos1.close();
    catch (java.io.IOException e) {}
    else
    BufferedImage imb = new BufferedImage((int)dim.getWidth(), (int)dim.getHeight(), BufferedImage.TYPE_INT_RGB);
    imb.setRGB(0, 0, (int)dim.getWidth(), (int)dim.getHeight(), pixels, 0, (int)dim.getWidth());
    try
    FileOutputStream fos2 = new FileOutputStream(file);
    Acme.JPM.Encoders.ImageEncoder e = new GifEncoder(imb, fos2);
    e.encode();
    fos2.close();
    catch (java.io.IOException e) {}
    catch (Exception er) {}
    break;
    case 1:
    try
    BufferedImage bimg = new java.awt.image.BufferedImage((int)dim.getWidth(), (int)dim.getHeight(), BufferedImage.TYPE_INT_RGB);
    bimg.setRGB(0, 0, (int)dim.getWidth(), (int)dim.getHeight(), pixels, 0, (int)dim.getWidth());
    //Encode as a JPEG
    FileOutputStream fos3 = new FileOutputStream(file);
    JPEGImageEncoder jpeg = JPEGCodec.createJPEGEncoder(fos3);
    jpeg.encode(bimg);
    fos3.close();
    catch (java.io.IOException e) {}
    break;
    case 2:
    try
    BufferedImage bimg = new java.awt.image.BufferedImage((int)dim.getWidth(), (int)dim.getHeight(), BufferedImage.TYPE_INT_RGB);
    bimg.setRGB(0, 0, (int)dim.getWidth(), (int)dim.getHeight(), pixels, 0, (int)dim.getWidth());
    //Encode as a PNG
    FileOutputStream fos3 = new FileOutputStream(file);
    PNGEncodeParam pp = PNGEncodeParam.getDefaultEncodeParam(bimg);
    ImageEncoder png = ImageCodec.createImageEncoder("PNG", fos3, pp);
    png.encode(bimg);
    fos3.close();
    catch (java.io.IOException e) {}
    break;
    case 3:
    try
    BufferedImage bimg = new java.awt.image.BufferedImage((int)dim.getWidth(), (int)dim.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
    bimg.setRGB(0, 0, (int)dim.getWidth(), (int)dim.getHeight(), pixels, 0, (int)dim.getWidth());
    //Encode as a TIF
    FileOutputStream fos3 = new FileOutputStream(file);
    TIFFEncodeParam tp = new TIFFEncodeParam();
    ImageEncoder tif = ImageCodec.createImageEncoder("TIFF", fos3, tp);
    tif.encode(bimg);
    fos3.close();
    catch (java.io.IOException e) {}
    break;
    case 4:
    try
    BufferedImage bimg = new java.awt.image.BufferedImage((int)dim.getWidth(), (int)dim.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
    bimg.setRGB(0, 0, (int)dim.getWidth(), (int)dim.getHeight(), pixels, 0, (int)dim.getWidth());
    //Encode as a BMP
    FileOutputStream fos3 = new FileOutputStream(file);
    BMPEncodeParam bp = new BMPEncodeParam();
    ImageEncoder png = ImageCodec.createImageEncoder("BMP", fos3, bp);
    png.encode(bimg);
    fos3.close();
    catch (java.io.IOException e) {}
    break;
    } //end of switch.
    } //end of file option.
    //Here is NewImageProducer
    import java.awt.image.*;
    import java.util.*;
    import java.awt.*;
    import java.applet.*;
    import java.awt.color.*;
    class NewImageProducer implements ImageProducer{
    private Vector vector = null;
    int[] pixels;
    int alpha;
    Dimension dim;
    public NewImageProducer(int[] pixels, int alpha, Dimension dim){
    vector = new Vector();
    this.pixels = pixels;
    this.alpha = alpha;
    this.dim = dim;
    public void addConsumer(ImageConsumer ic){
    if (isConsumer(ic) == false)
    vector.addElement(ic);
    public void removeConsumer(ImageConsumer ic){
    if (isConsumer(ic) == true)
    vector.removeElement(ic);
    public boolean isConsumer(ImageConsumer ic){
    return vector.indexOf(ic) > -1;
    public void startProduction(ImageConsumer ic){
    addConsumer(ic);
    int x = (int)dim.getWidth();
    int y = (int)dim.getHeight();
    Hashtable ht = new Hashtable();
    byte[] r = new byte[pixels.length];
    byte[] g = new byte[pixels.length];
    byte[] b = new byte[pixels.length];
    byte[] a = new byte[pixels.length];
    for (int i=0; i<pixels.length; i++)
    if (pixels[i] == alpha)
    a[i] = (byte)0;
    else
    a[i] = (byte)255;
    for (int i=0; i<pixels.length; i++)
    r[i] = (byte)((pixels[i] & 0xFF0000) >> 16);
    g[i] = (byte)((pixels[i] & 0x00FF00) >> 8);
    b[i] = (byte)(pixels[i] & 0x0000FF);
    ColorModel cm=null;
    try{
    cm = new IndexColorModel(8, pixels.length, r, g, b, a);
    catch (Exception e){e.printStackTrace();}
    Vector v = (Vector)vector.clone();
    Enumeration e = v.elements();
    while (e.hasMoreElements()){
    ic = (ImageConsumer)e.nextElement();
    ic.setColorModel(cm);
    ic.setDimensions(x, y);
    ic.setProperties(ht);
    ic.setHints(ImageConsumer.RANDOMPIXELORDER);
    int[] p = new int[pixels.length];
    for (int i=0; i<pixels.length; i++)
    p[i] = i;
    ic.setPixels(0, 0, x, y, cm, p, 0, x);
    ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
    public void requestTopDownLeftRightResend(
    ImageConsumer ic){;
    //Here is Utils
    import java.io.File;
    public class Utils {
    public final static String jpeg = "jpeg";
    public final static String jpg = "jpg";
    public final static String gif = "gif";
    public final static String tiff = "tiff";
    public final static String tif = "tif";
    public final static String png = "png";
    public final static String bmp = "bmp";
    * Get the extension of a file.
    public static String getExtension(File f) {
    String ext = null;
    String s = f.getName();
    int i = s.lastIndexOf('.');
    if (i > 0 && i < s.length() - 1) {
    ext = s.substring(i+1).toLowerCase();
    return ext;
    Get the Acme class at:
    http://www.acme.com/java/software/Package-Acme.JPM.html

  • How to save an image to file without rendering to screen?

    Does anyone know of a way I can save a buffered image to a file (as a jpg) without having to render it to a screen first? I can create the file fine if I place the image on a JPanel first. However when I try to save the image directly to a file, the program hangs when I try to render the image to a Graphics object. Is there some sort of initialisation carried out on the image when it is displayed on screen which I need to carry out to save the image offscreen?
    Just as a background, what I am trying to achieve is to create a chart (using Monarch Charts library) based on a supplied set of data, and then to save this chart as a jpg. It works fine if I first display the chart in a JPanel but not when I try to save it offscreen.
    Can anyone help me out here?
    Thanks,
    Ciaran

    Here's the code I use in JFreeChart to create a buffered image - the third line draws the chart using the Graphics2D obtained from the BufferedImage:
        public BufferedImage createBufferedImage(int width, int height) {
            BufferedImage image = new BufferedImage(width , height, BufferedImage.TYPE_INT_RGB);
            Graphics2D g2 = image.createGraphics();
            this.draw(g2, new Rectangle2D.Double(0, 0, width, height), null);
            g2.dispose();
            return image;
        }Writing to a JPEG can be done like this (method taken from the ChartUtilities class in JFreeChart):
        public static void writeChartAsJPEG(OutputStream out, JFreeChart chart, int width, int height)
            throws IOException {
            BufferedImage image = chart.createBufferedImage(width, height);
            JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
            JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(image);
            param.setQuality(1.0f, true);
            encoder.encode(image, param);
        }If you want to try some running code, download JFreeChart from:
    http://www.object-refinery.com/jfreechart/index.html
    ...then run this application:
    package com.jrefinery.chart.demo;
    import java.io.File;
    import com.jrefinery.chart.JFreeChart;
    import com.jrefinery.chart.ChartFactory;
    import com.jrefinery.chart.ChartUtilities;
    import com.jrefinery.chart.demo.DemoDatasetFactory;
    import com.jrefinery.data.XYDataset;
    public class ChartToFile {
        public static void main(String[] args) {
            XYDataset data = DemoDatasetFactory.createTimeSeriesCollection2();
            JFreeChart chart = ChartFactory.createTimeSeriesChart("Sample Chart", "Time", "Rate", data, true);
            File file = new File("MyChart.jpg");
            try {
                ChartUtilities.saveChartAsJPEG(file, chart, 400, 300);
            catch (java.io.IOException e) {
                System.out.println(e.getMessage());
    }Regards,
    Dave Gilbert
    www.object-refinery.com

  • How to save iPhoto images on disc

    Trying to save space on My HD, can't figure out how to save an album to a disc

    after having used iPhoto 08 for a long time the link between the program and the source files broke. i have a hard time restoring the library. how can i import ALL images on my harddisc into iphoto? is there a function that scans and finds all images automatically?
    You really would not want to do this - you would have a mess - many duplicates and lots of images that have nothing to do with photos
    Tell us more about your problem - what is happening and how it occurred
    Most likely you have all of your original Photos in the originals folder of your iPhoto library and simply quitting iPhoto, dragging the iPhoto library to the desktop, launching iPhoto and creating a new library and dragging each folder from the originals folder in your iPhoto library on the desktop onto the iPhoto icon in the dock (check to be sure that the iPhoto preference to split items imported from the finder is NOT checked) - this will recreate your events
    If this is not an option their probably is still help
    LN

  • How to save layer image

    Hi, I'm a newbe
    I need to save the image of a layer, but my asset is a psd file, how do I get the image from it?
    Thx

    hi nnzz! welcome to the forum!
    a layer's image pixels are gotten in the same way regardless of the source.
    if your effect is applied to it, you'll have the pixels handed to you from AE automatically.
    in any case you can get the layer's source item and render it through the render suite.
    once you have the pixel datayou can process it and save it in any way you like.

  • PSE 7 Windows 7, 1.5 TB disk, how to save the image

    I got a new PC with a 1.5 TB hard disk, running Windows 7 and PSE 7. With the help of this Forum I managed (changing the scratch disk with  ALT and CONTROL) to start and work with PSE 7.
    However, now I am unable to save the image, again the error message is: Scatch disk full.
    Any ideas how to solve the problem? 

    If you have a spare volume, allocate that as the scratch disk first, followed by the C drive as the second scratch disk.
    Sometimes you run short of RAM if you have lots of open images. Try saving and closing as you work.

  • How to save inline images

    Hi,
    Using java mail api.
    Not able to save those images which are embedded as part of a mail message body.
    It has no filename.
    How can it be stored and showed as part of web-application whichreplicates the microsoft outlook.

    Thank you for your reply.
    But I hav few questions here.
    How do I translate cid references and save?
    I get cid reference name with getHeader("Content-ID");
    But this gives me String.Just a name.
    How do I save this?
    ***Is this the way it is or any othe way is there.***
    Plz Plz PLz help me.
    Its a very big big issue for me.
    It would be helpful If anybody can help witha bit of coding example.

  • How to save an image on iOS Safari direct to iCloud Drive

    I'm currently browsing Safari on my iPhone and found a picture I'd like to save.
    There's no option for me to save it to a user-created folder in iCloud Drive. Why?
    I basicly have no way to browse, create, move, copy and share files with others
    on iCloud Drive.
    My opinion is iCloud Drive is no Dropbox killer, AT ALL!

    I don't know of any way to save an image from IOS Safari "direct" to iCloud, but FWIW I don't know how to do that "direct" to Dropbox either.
    However, there are lots of ways to get a Safari image to iCloud albeit not quite "directly."
    1.  Send a link of the image from your IOS device to a Mac.   Open the link on the Mac and copy the image to your desktop.  Open iCloud and drag and drop the image there.
    2.  Copy the image from IOS Safari, open an email to yourself, and paste the image.  Open the email on your Mac and proceed as in #1.
    3.  Copy the image in IOS Safari, open a Pages document, and paste the image there.  It will automatically be saved to iCloud.
    4.  Petition Apple to implement the "direct" transfer.
    And there may well be other ways too - this can't exhaust the possibilities.
    Hope this helps.

Maybe you are looking for

  • Duplicate Italic Keywords in Bridge

    You asked.... In the keyword panel,I have the same keyword in several places in the hierarchy. I think some came in as legacy keywords, and others, I inadvertently created the same keyword twice. These duplicates appear in different parts of the whol

  • Link to URL - How to Open a New Tab

    I have created some PDF's in Adobe Acrobat and I am hosting them on my website. So for example here is one: <possible spam link removed - kglad> I have created links to URL's using the Link Properties tool, Actions tab. However it will only open the

  • Total count and count based on column value

    Primaryid  Id     Status 1            50          1 2            50          1 3          50          1 4            50          3 5           50          2 6            50          1 7            51         1 8            51         2Im looking for

  • PO item 00010 included in IDoc twice

    Hi:   I work in SRM 5.0 ,MM-SUS scenario .   The vendor does confirmation  in SUS .I can find the IDOC from XI .But there is an error about the IDOC .It dispalys "PO item 00010 included in IDoc twice", What is the reason?   PS: I create IDOC Distribu

  • Transfer photo prints to iPhoto

    I have photo prints from old fashioned film rolls. If I scan them, can they be put into iPhoto Library, and if so, will they behave the same as any digital picture ?