Converting an Image to a PlanarImage

I have captured a frame from a video clip as an Image, and want to send this through a series of filters I have programmed.
These filters use JAI and so take PlanarImages as inputs.
I therefore wouldlike to convert an Image to a PlanarImage. Any suggests would be much appreciated.
Also I before I send my Image through the filtering, I want to split the RGB image into 3 gray_scale images (one for each band). I am also struggling with this.
I can get the A,R,G,B of the image easily enough, but I don't know how to transform these into seperate Images or PlanarImages.
Cheers,
Adam

The following should do it
Image src = BufferToImage.createImage(WHATEVER);
RenderedOp result = JAI.create("AWTImage",src);RenderedOp is a PlanarImage and also implements RenderedImage.
I would split the image into colour bands after you get it into the
JAI domain. There is a simple operation to do it.
public RenderedOp getBand(RenderdOp src, int band) {
  int[] bands = new int[1];
  bands[0] = band; // select band
  ParameterBlockJAI param = new ParamterBlockJAI("BandSelect");
  param.addSource(src);
  param.add("bandIndices", bands);
  return JAI.create("BandSelect",param);
}matfud

Similar Messages

  • Unable to convert an image (.bmp) to PDF

    I have a written servlet that uses Adobe LiveCycle API to convert files to PDF. This works. I have a problem with one image (.BMP) for which the PDF conversion fails. I then tried converting the image to PDF using Adobe Acrobat. I see the following error:
    I am able to open the image file without any issues. Why does Acrobat think the file is corrupt? Is there a way to find out if an image is OK for PDF conversion, either manually or programmatically? Attaching the image file for reference.

    Hi ,
    For this issue, it looks like your SharePoint server(s) have been patched with MS13-052. 
    Please try to uninstall it and reboot your machine.
    Here is a similar post for you to take a look at:
    https://social.technet.microsoft.com/Forums/sharepoint/en-US/eec6e515-6a0a-42f2-963d-51fde59be9c4/sharepoint-server-20102-abnormal-issues-please-help
    Best Regards,
    Wendy
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How can I convert an image created in Photoshop into a format that Java's ImageIO library will take?

    Hi all,
    I've been trying to write an image resize tool to use the Lancoz resample algorithm to resize images to a high standard in Java.  The library with the algorithm/filter in it is mortennobel's image scaling library and it takes a buffered image as an input and returns the resized image as desired.  However the trouble I’m having is that the ImageIO library in Java, a standard library, which converts images given to its read method to buffered images doesn't accept certain images created in Photoshop and so it throws an exception.  My library needs to be fully automated to process possible thousands of images at a time and so manually converting them by resaving them as JPEG's is really feasibly.  Is there some way I can convert these images from Adobes Exif format to standard JFIF format?  I've tried simple inserting the APP0 marker from a JFIF image in-between the SOI and APP1 marker but the ImageIO library still failed.
    The above image is a screenshot of the binary in hex of one of the images that cause an Invalid Format exception when passed to ImageIO.
    Any help you could offer me with this would be much appreciated.
    Kind regards and thank you,
    Alexei Blue
    Science Warehouse.
    NB: I previously posted this post in Developers but was told to post it in a Photoshop forum so apologies if this is the incorrect formum

    The image scaling library does have a BiCubicFilter in it so I'll experiment around with them and see what happens.  As for the imageIO library I think it accepts Exif image types, but still for some reason it just doesn't like Adobe Photoshop types.  Maybe its the colour map it doesn't like I just can't seem to work out what's wrong which is slightly frustrating but looking round to see if I can find an answer

  • Need to convert an image to .jpeg using Java !

    Hello,
    i am working in images now. i need to convert any image in the form of .jpeg using Java. in other words, i need to store an image in the form of .jpeg format. can any of u help me ! thanks in advance.
    - Krishna

    There's also jimi, at http://java.sun.com/products/jimi/
    You can do something like:
    image = new BufferedImage (width, height, BufferedImage.TYPE_INT_RGB);
    // create your image
    String path = "/path/image.jpg";
    Jimi.putImage(image, path);
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How can I convert an Image ( or BufferedImage ) to Base64 format ?

    Hi folks...
    How can I convert an Image, or BufferedImage, to the Base64 format ?
    The image that I want to convert, I get from the webCam connected to the computer...
    Anyone can help me ?
    Rodrigo Kerkhoff

    I suggest you read this thread concerning this:
    http://forum.java.sun.com/thread.jspa?forumID=31&threadID=477461
    Failing that, Google is your friend.
    Good luck!

  • How can i convert an image into gif file as jpeg by using com.sun.image.*

    please help me to convert an image into gif format. i have used sun's impl com.sun.image.code.jpeg package to convert a buffered image into a jpeg file. is there any implementatioln available from sun to handle gif files.

    Many. Try for instance google with 'java image encoders'. Go to the URL http://www.google.com/search?q=java+image+encoders and be amazed of the wonders of modern web search tools.

  • How to convert an Image to a byte array?

    I want to make a screenshot and then convert the image to a byte of arrays so I can send it through a BufferedOutputStream.
    try
                   robot = new Robot();
                   screenshot = robot.createScreenCapture(new Rectangle(500,500));
                   imageFile = new File("image.png");
                   ImageInputStream iis = ImageIO.createImageInputStream(screenshot);
                   byte[] data = new byte[1024];
                   byte[] tmp = new byte[0];
                   byte[] myArrayImage = new byte[0];
                   int len = 0;
                   int total = 0;
                   while((len = iis.read(data)) != -1 ) // LINE 52 --- EXCEPTION CATCHED HERE
                        total += len;
                        tmp = myArrayImage;
                        myArrayImage = new byte[total];
                        System.arraycopy(tmp,0,myArrayImage,0,tmp.length);
                        System.arraycopy(data,0,myArrayImage,tmp.length,len);
                   ios.close();I get this exception while running:
    Exception in thread "Thread-0" java.lang.NullPointerException
    at Server.run(Server.java:52)
    at java.lang.Thread.run(Unknown Source)

    Fixed that. I got a new problem.
    When I connect to my simple server application that reads the image file, converts it to an array of bytes and sends it back, the file is created on the client side and it containts data, but I am not able to open the image. I have checked that the image that the server is sending is working. So where is the problem?
    The client application recieves the image as following:
    public void run()
            try
                socket = new Socket("127.0.0.1", 2000);
                BufferedOutputStream out_file = new BufferedOutputStream(new FileOutputStream("recieved_img.png"));
                BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
                int inputLine;
                while((inputLine = in.read()) != -1)
                    char c = (char)inputLine;
                    System.out.println(c);
                    out_file.write(inputLine);
            catch(IOException err){ err.printStackTrace(); }
        }And the server sends the image like this;
    try
              socket = server.accept();
              in=new BufferedReader(new InputStreamReader(socket.getInputStream()));
              out = new BufferedOutputStream(socket.getOutputStream());
              out.write(25);
              while((inputLine = in.readLine()) != null)
                   System.out.println(myArrayImage.length);
              System.out.println(inputLine);
                        out.write(myArrayImage);     // Send the array of bytes
         }

  • When I try to print an jpeg or png from Photoshop all it does is convert the image to a PDF & plop it on my desktop- it won't print the image. Any suggestions as to how to fix this?

    When I try to print an jpeg or png from Photoshop all it does is convert the image to a PDF & plop it on my desktop- it won't print the image. Any suggestions as to how to fix this?

    Yes, the printer is on, it’s selected in Printer Set-Up & I’ve never had this problem before. It’s definitely a Photoshop issue as every other type of file prints fine. I’ve uninstalled Pshop & am now reinstalling. Hope that will do the trick.

  • Hi, how can i break the value for a row and column once i have converted the image to the array?????​??

    Hi, I would like to know how can i break the value for a row and column once i have converted the image to the array. I wanted to make some modification on the element of the array at a certain position. how can i do that?
    At the moment (as per attachhment), the value of the new row and column will be inserted by the user. But now, I want to do some coding that will automatically insert the new value of the row and the column ( I will use the formula node for the programming). But the question now, I don't know how to split the row and the column. Is it the value of i in the 'for loop'? I've  tried to link the 'i' to the input of the 'replace subset array icon' , but i'm unable to do it as i got some error.
    Please help me!
    For your information, I'm using LABView 7.0.

    Hi,
    Thanks for your reply.Sorry for the confusion.
    I manage to change the array element by changing the row and column value. But, what i want is to allow the program to change the array element at a specified row and column value, where the new value is generated automatically by the program.
    Atatched is the diagram. I've detailed out the program . you may refer to the comments in the formula node. There are 2 arrays going into the loop. If a >3, then the program will switch to b, where if b =0, then the program will check on the value of the next element which is in the same row with b but in the next column. But if b =45, another set of checking will be done at a dufferent value of row and column.
    I hope that I have made the problem clear. Sorry if it is still confusing.
    Hope you can help me. Thank you!!!!
    Attachments:
    arrayrowncolumn2.JPG ‏64 KB

  • Converting RGB images (sRGB or Adobe RGB) to 709 color space.

    I'm trying to determine the correct way to convert RGB images (sRGB or Adobe RGB) to 709 color space.  I can't just use the "covert to profile" function to do this because it does not produce results that fall within the 16 to 235 range that 709 dictates.  I've read that you can simply use the "Levels" adjustment and change the output levels to 16 to 235.  While this would clearly compress the luminance to the correct range, I'm not entirely clear if the end result would be a proper conversion (i.e. if color and gamma, for example, would be technically correct.)
    I noticed that converting the profile to "HDTV (Rec. 709)" does alter the image, so I'm wondering what the result would be if I did both this AND used the levels control to compress the output range to 16 to 235.
    Thanks for any feedback on this.

    (1)
    http://en.wikipedia.org/wiki/Rec._709
    (2)
    http://en.wikipedia.org/wiki/Rec._601
    The transfer functions for Rec.709 (1) refer to the range [0..1] or for 8 bits per pixel [0...255].
    It seems that the clipping, black=16 and white=235 has to happen after the application of the
    transfer function. If this should be true, then we don't have a level compression but a level
    clipping at both ends, as already for Rec.601 (2), like here:
    The ICC-Profile HDTV(Rec.709) in Photoshop contains the primaries and the white point
    (both like that in sRGB) and the transfer functions for [0..1], coded by a LUT with high resolution,
    as found by Profile Inspector. There is no clipping.
    By the way, that`s the internal profile name, I don't know the file name of the profile.
    Softproofing, source in sRGB, target HDTV(Rec.709), without clipping:
    With numbers not preserved: no change of the appearance, as expected.
    With numbers preserved: shows the effect of different effective gammas. 
    Your questions are very clear and I'm not sure whether my comments help. The information
    in the internet is not convincing.
    Best regards --Gernot Hoffmann

  • Convert color images to black&white bitmaps

    Hi,
    I have black&white scans of public domain books (image format). I use an OCR software to convert them to indexable PDFs (image+text format). However, the OCRed PDFs are insanely big: a 27 MB scanned PDF leads to an indexable PDF of 728 MB! And unfortunately, my OCR software doesn't have output settings, so I have to find a way to compress the files using Adobe Acrobat 9 Pro.
    Using Advanced Options > Optimization does reduce the file size, but not significantly. The problem seems to be that my OCR software converts the black&white scans to color images, and encodes them as such inside the PDF. So I need a way to set the image modes back to black&white. I tried using the Advanced Options > Preflight dialog, and selecting "Convert to black&white". However, the resulting PDFs stay about the same size! It seems that "Convert to black&white" converts the images to grayscale, instead of to bitmap.
    Any help would be appreciated!

    I mentioned "bitmaps", because when I open the original PDF and right-click a random page and select "Modify image..." and open the image in Photoshop, the mode is set to "Bitmap mode": meaning 1-bit mode, containing either black or white pixels. However, when I do "Modify image..." for the OCRed PDF, the mode is set to "RGB Color Mode". I think this explains, in part, the huge size of the OCRed PDF.
    Maybe this table will make it more clear:
    Original PDF (Bitmap Mode, 132 dpi)
    Size: 27 MB
    OCRed PDF (RGB Color Mode, 300 dpi)
    Size: 728 MB
    Now, from the table above, it's clear that I have to reduce the image resolution. So, using the Acrobat's PDF optimizer, I tried the following settings:
    Optimized OCRed PDF: Try 1 (Downsample to 132 dpi, JPEG compression)
    Size: 733 MB
    Optimized OCRed PDF: Try 2 (Downsample to 132 dpi, ZIP compression)
    Size: 449 MB
    But 449 MB is still huge for a single book. And I don't want to reduce the resolution under 132 dpi, because I will loose quality. Clearly, if the original document is just 27 MB, I should be able to squeeze the OCRed document too. But I don't know how.

  • To convert multiple image files to pdf using pdfsharp in C#

    Hey guys I have this C# code to convert any image file to .pdf using pdfsharp.dll. But I want to select multiple images for conversion please help. here's my code (plz note enable pdfsharp.dll in the reference)
    usingSystem;
    usingSystem.Collections.Generic;
    usingSystem.Linq;
    usingSystem.Text;
    usingSystem.Threading.Tasks;
    usingPdfSharp.Pdf;
    usingPdfSharp.Drawing;
    usingSystem.IO;
    namespaceConsoleApplication1
    classProgram
    staticvoidMain(string[]
    args)
    PdfDocumentdoc =
    newPdfDocument();
    doc.Pages.Add(newPdfPage());
    XGraphicsxgr =
    XGraphics.FromPdfPage(doc.Pages[0]);
    XImageimg =
    XImage.FromFile(source
    path...);
    xgr.DrawImage(img,0,0);
    doc.Save(destination path...);
    doc.Close();

    try this one
    public string CreatePDF(System.Collections.Generic.List<byte[]> images)
    dynamic PDFGeneratePath = Server.MapPath("../images/pdfimages/");
    dynamic FileName = "attachmentpdf-" + DateTime.Now.Ticks + ".pdf";
    if (images.Count >= 1) {
    Document document = new Document(PageSize.LETTER);
    try {
    // Create pdfimages directory in images folder.
    if ((!Directory.Exists(PDFGeneratePath))) {
    Directory.CreateDirectory(PDFGeneratePath);
    // we create a writer that listens to the document
    // and directs a PDF-stream to a file
    PdfWriter.GetInstance(document, new FileStream(PDFGeneratePath + FileName, FileMode.Create));
    // opens up the document
    document.Open();
    // Add metadata to the document. This information is visible when viewing the
    // Set images in table
    PdfPTable imageTable = new PdfPTable(2);
    imageTable.DefaultCell.Border = Rectangle.NO_BORDER;
    imageTable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
    for (int ImageIndex = 0; ImageIndex <= images.Count - 1; ImageIndex++) {
    if ((images(ImageIndex) != null) && (images(ImageIndex).Length > 0)) {
    iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(SRS.Utility.Utils.ByteArrayToImage(images(ImageIndex)), System.Drawing.Imaging.ImageFormat.Jpeg);
    // Setting image resolution
    if (pic.Height > pic.Width) {
    float percentage = 0f;
    percentage = 400 / pic.Height;
    pic.ScalePercent(percentage * 100);
    } else {
    float percentage = 0f;
    percentage = 240 / pic.Width;
    pic.ScalePercent(percentage * 100);
    pic.Border = iTextSharp.text.Rectangle.BOX;
    pic.BorderColor = iTextSharp.text.BaseColor.BLACK;
    pic.BorderWidth = 3f;
    imageTable.AddCell(pic);
    if (((ImageIndex + 1) % 6 == 0)) {
    document.Add(imageTable);
    document.NewPage();
    imageTable = new PdfPTable(2);
    imageTable.DefaultCell.Border = Rectangle.NO_BORDER;
    imageTable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
    if ((ImageIndex == (images.Count - 1))) {
    imageTable.AddCell(string.Empty);
    document.Add(imageTable);
    document.NewPage();
    } catch (Exception ex) {
    throw ex;
    } finally {
    // Close the document object
    // Clean up
    document.Close();
    document = null;
    return PDFGeneratePath + FileName;

  • Illustrator image copy/paste onto the Indesign the text should automatically converted into image?

    Hi All,
    Is there options to get the image copy & paste into the Indesign, if i done manually the frames and lines stroke, colors, are coming fine, but the text object only converted the image. i want to edit text  in indesign.
    this is possible for scripting or manual?
    regards
    CSM_PHIL

    You can copy/paste from Illy to ID by selecting the text with the type tool in Illy and then pasting it into ID. You will not be able to maintain the formatting. If you want to maintain the appearance the text will be converted to outlines.
    If you need to get anything other than very simple objects from Illy to ID then you should save as AI and use the file > place command to place those objects as linked graphics into ID.
    Your closing statement is irrelevant. Whether you like it or not, this is the way it is.
    Bob

  • Can I convert 3D image to an array of pixels in LabVIEW?

    Hi all;
    I am still new with labview. I has 1 question, can I convert 3D image to an array of pixels using labview?
    Most of the examples I found they only convert 2D image. Hope anyone can give me some hint.
    Thank You

    look at this thread.
    It has links to other threads where the 3D graphs were used.
    You should also search for "gif reader" to find threads where images are read from gif files.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Convert original image to sharp Line art?

    Dear All,
    I have a image i want to convert orginal image to sharp lineart how can i do photoshop CS3 please help me.
    one reference image is attached

    As others have said I dont think you will be able to convert the image you have posted to look like the result you want from the other image you posted, the detail in the original is just to high. I use the method described below for doing my line art in Photoshop and it works well but you seem to want to reduce your image to a much simplier representation. I have used this site before, it used to be free but now I think you only get a couple of free credits when you join, convert a photo to line drawing, quite simple to use and you can select to remove noise which might reduce the complexity of the original image.
    In Photoshop try:
    Duplicate original layer
    Change top layer color mode to color dodge
    Invert top layer
    Apply Gaussian blur (choose low pixel radius for less detail so reducing image complexity)
    Add adjustment layer and set saturation to be -100
    Retouch anywhere with brush tool to complete

Maybe you are looking for

  • Upgrading Hyperion applications from EPM System 11.1.2.1 and 11.1.2.2. to 11.1.2.3

    Hi, I am triyng to upgrade Hyperion classic applications from 11.1.2.1 and 11.1.2.2 to 11.1.2.3. I restored application's databases which has SQL database and upgraded applications successfully. But the other applications that have Oracle databases, 

  • Computer won't fully boot in Yosemite 10.2.2

    Today I tried to start my MBP 15" Retina (early 2013) running OS X 10.2.2 and what happens is I get the apple logo and the white line below only moves to about 1/4 the distance and then hangs up. A few weeks ago the emergency boot disk disappeared an

  • Keynote defaulting to PowerPoint

    When I try to open a Keynote file, the files always open in PowerPoint even though the default is set to Keynote. How can I make it open each file in the correct program? I've tried to reset the default using the info panel, but it didn't work and th

  • How to access an attribute(this is referencing to another class) in a class

    Dear Gurus, I have to read an attribute of a class and that attributes type another class. I have intantiated the class and my question is how to read the attribute. I know I can not dirrectly read the attribute since this is another class. I think I

  • Whta is wrong im my code ?

    I have had some problems to connect a data base . can you help me? try double RG = Double.valueOf((requisicao.getParameter("rg"))).doubleValue();// pegando do formulario /*Coneccao com o banco*/ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String u