Convert jpg image to array of integers and store in file

For a project that I am working on I need to be able to take the black and white jpg images that I am using and convert each pixel into either a -1 or +1 according to if the pixel color is white or black. Then, once I have an array of those values, I need to store the array to a file. Can this be done? Can PixelGrabber accomplish this task? Thanks in advance!
Keith Pemberton

Yes
PixelGrabber pg = new PixelGrabber(myImage, 0, 0, width, height, pixels, 0, width);

Similar Messages

  • Convert Jpg images into patterns (.pat)

    Is it possible to Batch convert Jpg images into .pat files? I am familiar with the define pattern function but what I really need is to convert many jpg's.
    Thanks

    Use edit Define pattern on the image to define a Photoshop pattern. Then use the preset manager to save the pattern as a *.pat file.....
    To batch this you may need to use a Photoshop Script to name the patterns a action define pattern step would have a hard code pattern name. Changing that step to a script could retrieve the document name and set the pattern name the same as the jpeg name.  You could define many patterns that way then use the preset manager select all the defined patterns and save a single *.pat file with that set of patterns.

  • HT201250 Can I back up with time machine AND store additional files on the same external drive?

    I just bought an external drive to move and archive some files off my iMac to free up some space. I'm being asked if I want to use the drive to back up files with Time Machine. Can I use this drive to do both? (Back up with TM AND store other files?
    Your input is appreciated.

    Technically you can but it is not a very good idea at all. The reason it is a flawed idea is if the HD fails (not really if but when) you will have defeated the whole idea of backup. A failure means you will lose the data files you stored on it and it's backup! A good backup plan has at least 2 forms of backup because backups can fail too. I would strongly recommend getting at least one additional external HD and use it for storing the data files you wanted off the internal HD and use the second for a Time Machine backup drive.
    Personally I have 3 external HD's attached to my computer. Disk 1 is my Time Machine backup, Disk 2 is a Bootable Clone of my internal HD and Disk 3 stores my music, photography and movie libraries.
    Please read these articles, they will discuss different backup strategies and I think you will see that each suggest redundant backups.
    Backup Plan I
    Backup Plan II
    Backup Plan III

  • Export data in CSV and store the file in local drive

    Hi,
    Here is the requirements.
    Fetch the values from table (around 60000 records), and export them into CSV file and store the file in local drive.
    I have written servlet to to this and it is working fine expect saving the file in local drive. At the moment, it is asking to save as in local drive. i want to save the file automatically in particular path (/var/www/files/). Below is the code.
    String file = "CandidatesDetails" + sd + ".csv";
                        queryString = "select * from candidate where candidate.status='A'";
                        connection = ConnectionPoolHelper.getConnection();
                        response.setContentType("application/csv");
                        response.setHeader("content-disposition", "filename=" + file);
                        System.out.println("Query= " + queryString);
                        ps = connection.prepareStatement(queryString,
                                  ResultSet.TYPE_SCROLL_INSENSITIVE,
                                  ResultSet.CONCUR_READ_ONLY);
                        rs = ps.executeQuery();
                        datas = "CANDIDATE ID,CANDIDATE TITLE,FIRST NAME,LAST NAME,E-MAIL,NATIONALITY ID,NATIONALITY,COUNTRY ID,COUNTRY NAME,INDUSTRY ID,INDUSTRY DESCRIPTION,EXPERIENCE,DATE OF BIRTH,HEAR ABOUT US\n";
                        oout.write(datas);
                        String country = "";
                        String nationality = "";
                        String hearABtUs = "";
                        while (rs.next()) {
                             nationality = rs.getString(7);
                             if (nationality == null)
                                  nationality = "";
                             else if (nationality.equals("null"))
                                  nationality = "";
                             country = rs.getString(9);
                             if (country == null)
                                  country = "";
                             else if (country.equals("null"))
                                  country = "";
                             hearABtUs = rs.getString(14);
                             if (hearABtUs == null)
                                  hearABtUs = "";
                             else if (hearABtUs.equals("null"))
                                  hearABtUs = "";
                             else
                                  hearABtUs = hearABtUs.replaceAll(",", ";");
                             datas = rs.getInt(1) + "," + rs.getString(2) + ","
                                       + rs.getString(3) + "," + rs.getString(4) + ","
                                       + rs.getString(5) + "," + rs.getInt(6) + ","
                                       + nationality + "," + rs.getInt(8) + "," + country
                                       + "," + rs.getInt(10) + "," + rs.getString(11)
                                       + "," + rs.getString(12) + "," + rs.getString(13)
                                       + "," + hearABtUs + "\n";
                             oout.write(datas); Regards,
    Dongan.

    Here is the first few lines
    public void doGet(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
              HttpSession session = request.getSession(true);
              String datas = "";
              PreparedStatement ps = null;
              ResultSet rs = null;
              String queryString = "";
              Connection connection;
              PrintWriter oout = response.getWriter();
              java.util.Date d = new java.util.Date();
              SimpleDateFormat dateformat = new SimpleDateFormat("dd-MMM-yyyy");
              String sd = dateformat.format(d);
              tryAt the moment, when i run http://localhost:8080/project/CandidatesDetail, it will ask me to save the file somewhere. I should manually mention the path to save the file. what i want is, it should automatically save it in the location C:\projects\files\.
    thanks.
    Regards,
    Dongan
    Edited by: Dongan on Oct 26, 2007 5:22 AM

  • How to convert JPG image to BMP ? (Printing jpg images in smartforms from content server)

    Hi,
    We have employee photos(JPG Format) stored in Content server. And now we want to print the photos in smartforms. For this I had written the below code to read the photo from content server in binary format as below.
    REPORT ZTEST1.
    PARAMETERS P_PERNR TYPE PERNR_D.
    DATA: PS_CONNECT_INFO TYPE TOAV0,
          IT_BINARY TYPE TABLE OF SDOKCNTBIN.
    CALL FUNCTION 'HR_IMAGE_EXISTS'
      EXPORTING
        P_PERNR                     = P_PERNR
    *   P_TCLAS                     = 'A'
    *   P_BEGDA                     = '18000101'
    *   P_ENDDA                     = '99991231'
    IMPORTING
    *   P_EXISTS                    =
       P_CONNECT_INFO              = PS_CONNECT_INFO
    * EXCEPTIONS
    * ERROR_CONNECTIONTABLE       = 1
    *   OTHERS                      = 2
    IF SY-SUBRC <> 0.
    * Implement suitable error handling here
    ENDIF.
    IF PS_CONNECT_INFO IS NOT INITIAL.
      CALL FUNCTION 'SCMS_DOC_READ'
        EXPORTING
       STOR_CAT                    = SPACE
       CREP_ID                     = PS_CONNECT_INFO-ARCHIV_ID
          DOC_ID                      = PS_CONNECT_INFO-ARC_DOC_ID
    *   PHIO_ID                     =
    *   SIGNATURE                   = 'X'
    *   SECURITY                    = ' '
    *   NO_CACHE                    = ' '
    *   RAW_MODE                    = ' '
    * IMPORTING
    *   FROM_CACHE                  =
    *   CREA_TIME                   =
    *   CREA_DATE                   =
    *   CHNG_TIME                   =
    *   CHNG_DATE                   =
    *   STATUS                      =
    *   DOC_PROT                    =
    TABLES
    *   ACCESS_INFO                 =
    *   CONTENT_TXT                 =
       CONTENT_BIN                 = IT_BINARY
    * EXCEPTIONS
    * BAD_STORAGE_TYPE            = 1
    *   BAD_REQUEST                 = 2
    *   UNAUTHORIZED                = 3
    * COMP_NOT_FOUND              = 4
    *   NOT_FOUND                   = 5
    *   FORBIDDEN                   = 6
    *   CONFLICT                    = 7
    * INTERNAL_SERVER_ERROR       = 8
    *   ERROR_HTTP                  = 9
    * ERROR_SIGNATURE             = 10
    *   ERROR_CONFIG                = 11
    *   ERROR_FORMAT                = 12
    * ERROR_PARAMETER             = 13
    *   ERROR                       = 14
    *   OTHERS                      = 15
      IF SY-SUBRC <> 0.
    * Implement suitable error handling here
      ENDIF.
    ENDIF
    Now the issue is I want to convert that binary data to bitmap image and upload the same in to SE78. So that I can use that BMP image from SE78 in my smartforms.
    I had used the class CL_IGS_IMAGE_CONVERTER to covert the image into bmp but it is giving error that error in IMAGE DATA CORRUPT & Error Code 3. The conversion code used is as below.
    ******* CONVERT THE JPG IMAGE INTO BMP PHOTO. **********
      DATA: L_IGS_IMGCONV TYPE REF TO CL_IGS_IMAGE_CONVERTER,
    L_IMG_BLOB    TYPE W3MIMETABTYPE,
    L_IMG_SIZE    TYPE W3PARAM-CONT_LEN,
    L_IMG_TYPE    TYPE W3PARAM-CONT_TYPE,
             L_IMG_SUBTYPE TYPE W3PARAM-CONT_TYPE,
    L_IMG_URL     TYPE W3URL,
    L_ERR_CODE    TYPE I,
    L_ERR_TEXT    TYPE STRING,
             P_DEST TYPE CHAR32 VALUE 'IGS_RFC_DEST'.
      DATA: G_IMG_BLOB     TYPE W3MIMETABTYPE,
          G_IMG_TYPE     TYPE W3PARAM-CONT_TYPE,
          G_IMG_SIZE     TYPE W3PARAM-CONT_LEN.
      IF NOT IT_BINARY[] IS INITIAL.
        G_IMG_BLOB[] = IT_BINARY.
        CREATE OBJECT L_IGS_IMGCONV
          EXPORTING
            DESTINATION = P_DEST.
        CALL METHOD L_IGS_IMGCONV->SET_IMAGE
          EXPORTING
            BLOB      = G_IMG_BLOB
            BLOB_SIZE = G_IMG_SIZE.
        CASE PS_CONNECT_INFO-RESERVE.
          WHEN 'TIF'.
            G_IMG_TYPE = 'image/tiff'.
          WHEN 'JPG'.
            G_IMG_TYPE = 'image/jpeg'.
          WHEN 'PNG'.
            G_IMG_TYPE = 'image/png'.
          WHEN 'GIF'.
            G_IMG_TYPE = 'image/gif'.
          WHEN 'BMP'.
            G_IMG_TYPE = 'image/x-ms-bmp'.
          WHEN OTHERS.
            EXIT.
        ENDCASE.
    L_IGS_IMGCONV->INPUT  = G_IMG_TYPE.
        L_IGS_IMGCONV->OUTPUT = 'image/x-ms-bmp'.
    *    PERFORM GET_SIZE USING PICTURE_CONTAINER
    * L_IGS_IMGCONV->WIDTH
    * L_IGS_IMGCONV->HEIGHT.
        CALL METHOD L_IGS_IMGCONV->EXECUTE
          EXCEPTIONS
            OTHERS = 1.
        IF SY-SUBRC IS INITIAL.
          CALL METHOD L_IGS_IMGCONV->GET_IMAGE
            IMPORTING
              BLOB      = L_IMG_BLOB
              BLOB_SIZE = L_IMG_SIZE
              BLOB_TYPE = L_IMG_TYPE.
          SPLIT L_IMG_TYPE AT '/' INTO L_IMG_TYPE L_IMG_SUBTYPE.
        ELSE.
          CALL METHOD L_IGS_IMGCONV->GET_ERROR
            IMPORTING
              NUMBER  = L_ERR_CODE
              MESSAGE = L_ERR_TEXT.
          BREAK-POINT.
        ENDIF.
      ENDIF.
    ENDIF.
    So could you please some one help me how to convert JPEG Photo to BMP programatically.
    Regards,
    Mayur.

    johnandersonpalmdesert wrote:
    My printer is requesting a vector file.
    Jpeg File format does not support vectors.  Photoshop has limited vector support and tools.  Photoshop can not save vector file formats like SVG.  What File type does your printer want?
    Adobe Illustrator is Adobe vector application.

  • Convert JPG images to PDF

    Working with 8.0 Pro. I want to basically open the JPG image and save it as a PDF via VB script. For some reason, I can't seem to make it work. Can anyone provide a few lines of code to do this?
    Thanks for any help.

    I can't think of a simple way to script this, except to open the JPEG
    in a separate application and print to PDF. But maybe you've found a
    way I missed. Can you share what you have tried?
    Aandi Inston

  • Fullview RAW/JPG Images in Aperture appear fractured and/or solid black

    Hey guys,
    I'm very close to throw something out of the window.
    I changed from iPhoto to Aperture 3.5.1 a few month ago and imports from my 400D Canon and iPhone/iPad worked finde until recently, when Aperture decided not to show thefull view anymore. It does show it either solid black or cramped full of pixel fragments from other programs.
    Below you can see how the mess looks like. The pictures were pixled by me after the Screenshot
    I already tried rebuilding the Database, backed the pictures up to our NAS and reinstalled Aperture. Nothing works. Thumbnails in Aperture seem to look fine and the CR2 Files are being opened in Photoshop just like always, eventhough Preview seems to have the same problem.
    I'd be so glad if any of you had a solution to my little problem ;_;
    Greetings from Hamburg Germany
    Nina

    I changed from iPhoto to Aperture 3.5.1 a few month ago and imports from my 400D Canon and iPhone/iPad worked finde until recently, when Aperture decided not to show thefull view anymore.
    Did you recently install the new Digital Camera RAW Compatibility Update 5.05  ?
    You can check this in the "About" panel from the main menu bar: Aperture > About Aperture.
    If you now are having the most recent raw support, did the problem occur directly after installing it?
    If reimporting did not help, try to create a new Aperture library (File > Switch to Library > other/new) and try to import a RAW file into the new library. Does that work?
    Hummel Hummel aus Hamburg
    Léonie

  • How can I export images out of LR3.5 and have the file numbers watermarked on them?

    Ladies & Gents,
    I'm trying to export a large number of images out of LR3.5 and want to show a unique reference number on each one as a watermark, so that customers can easily state which photo they're interested in.  I can't find anything on the export settings of the software with the exception of copyright symbols etc, but this just puts the same watermark on each photo and I want to number them individually and make it easy for the customer to identify an image.
    I'm guessing there will be a 'plug in' to do this and I don't mind paying for it, I would just rather do everything in LR and not have to then use a second piece of software and re-export all the images for a second time.
    One last thing..... I'm thinking of upgrading to LR4 in the near future and so I would like to be able to use any suggestions on that platform as well (if possible)
    Many thanks,
    Luke

    http://www.photographers-toolbox.com/products/lrmogrify2.php

  • Converting jpg images in email to pdf fail

    I have a user who uses Adobe X Pro, Windows 7-64(all updates applied) to convert her emails to a pdf.
    She USED to be able to do thei without any issue using 9x Pro
    Now with X Pro, she right clicks on a folder in her email, and clicks "convert "xxxxx" to Adobe pdf"
    It goes through the conversion proccess, and when she goes into the created pdf, NONE of the .jpg photos have been converted--BUT ALL the other types have been!!!! (tiff, img, etc...)
    This is annoying as F because it used to work flawlessly in her older version, but not X
    She is running it on a new Dell with 8 gigs ram, so should be more than adequate.
    WHY IS IT NOT PULLING THE JPGS OVER!!!!??!?!?!?
    need help with this ASAP

    My guess it is more of a problem than just AAX. You have suggested Win7-64 that is an issue also. Also what e-mail package as the settings there may be an issue. Anyway, as a first step should try to print the e-mail to the Adobe PDF (the one with the pictures in it) and see if that works. Then try to figure out the settings in the mail package. Based on what you have described there is a lot more going on than an upgrade with AAX, since AA9 is not really a 64-bit type of system, but I suspect that the OS is part of the problem (as a new OS -- OK, I could be wrong, but the gut feel is there is more than AAX in dealing with this issue).

  • Adding two array lists together and a text file to an array list

    I'm having problems coding these two methods... Could someone explain how to do this? I can't find information on it anywhere... :(
    "MagazineList" is the class I'm coding in right now, and I already declared "list" as an array list of another class called "Magazine".
    public boolean addAll(MagazineList magazines)
           if (list == magazines) {
               return false;
            else {
                list.addAll(magazines);
           return true;
       public boolean addAll(String filename)
           Scanner in = ResourceUtil.openFileScanner(filename);
            if (in == null) {
               return false;
            String line = source.nextLine();
            while (!line.equals("")) {
              list.add(Magazine(source));
           in.close();
       }

    I assume "addAll(MagazineList magazines)" is defined in the MagazineList class?
    Then,
    list.addAll(magazines);probably needs to be something like:
    list.addAll(magazines.list);This uses the private variable ( should be private) list from the input MagazineList, and adds all of those Magazine objects to the list in the current MagazineList.
    But, yes, describe your problems more clearly, and you'll get better answers more quickly (because people will be able to understand you and give you a suggestion without asking you another question first).

  • Depth data convert to Image Bgr, Byte in a windows store project

    Hi,
    i use EmguCv to process depth data from Kinect v2. Now i want to do it in a windows store 8.1 app. In older project i use these code to convert from writable bitmap:
    BitmapEncoder encoder = new BmpBitmapEncoder();
    encoder.Frames.Add(BitmapFrame.Create(depthBitmap));
    MemoryStream ms = new MemoryStream();
    encoder.Save(ms);
    Bitmap b = new Bitmap(ms);
    Image<Bgr, Byte> openCVImg = new Image<Bgr, Byte>(b);
    I the project i miss the bitmap class, i search the whole day for a solution...
    Thx for any hlp
    René

    The answer with help from Canming Huang (Thx):
    private Image<Bgr, Byte> Array2IImage(byte[] pixelArray)
    GCHandle dataHandle = GCHandle.Alloc(pixelArray, GCHandleType.Pinned);
    try
    using (Image<Bgra, Byte> image = new Image<Bgra, byte>(this.pixelWidth, this.pixelHeight, this.pixelWidth * this.cbytesPerPixel, dataHandle.AddrOfPinnedObject()))
    return image.Convert<Bgr, Byte>();
    finally
    dataHandle.Free();

  • Remember, and store Processed files Q's ???

    I've got "Process in Background" checked, so that while I'm working on my menus, it's "Ticking away"
    This is great, storing the rendered Mpeg files in the dvdproj package.
    However... EVERY time I want to burn a new DVD of my work, I have to wait for it to "Rendering Menu Video Asset", "Process Slideshows", and "Process Movies, Encode Audio / Play Movie", before it starts burning my second DVD.
    The computer already "Did this work" rendering everything for the first one, and I can't find a Preference to "Store all rendering to the project package"
    If i know I want to make several coppies, is it in my best interedt to select "Make Image"
    Then, to make DVD's what do I mount the image with to burn ?? Disk Utillity ? or is it a special kind of image I have to mount with iDVD to burn ??

    I turned off background processing and I have found that my system actually works better. The DVD burns cleanly without sync problems or other flaky issues, and iDVD does not go through the whole menu of processes after the first disk.
    Goyo

  • Time Capsule- Can i use it for Time Machine and store media files?

    Hi,
    I'm very new to Time Capsule (have a 1TB TC), but have been using Time Machine to back up my MacBook Pro onto an external HD for a while now.
    Here's my question. is it possible to use the Time Machine capabilities of Time Capsule while also using it to store music and picture files. Ideally I'd like to be able to have my iTunes and iPhoto library available on the Time Capsule. that way it could be centralized and readable from a few Macs in the house.
    Thanks!

    brianfallen wrote:
    When you say the info on it won't be backed up. What do you mean "the info on it"? Do you just mean the mp3, AAC ...etc files aren't backed up because they live on the TC only?
    I just want to make sure cause I did the same thing but I want to make sure I wont lose all my music and photos.
    If the only place you have these music and photo files is on the TC HDD, then if the TC HDD fails, you lose all those files. Here's another option. TC has an archive feature. That means you can, via AirPort Utility -> Disks, use the Archive feature to clone the TC HDD onto a USB HDD attached to the USB port of TC. It's not like TM, making incremental backups. You have to manually archive it, but it is an alternative.
    My photos remain on my iMac internal HDD. That means they are backed up by TM onto the TC HDD. If my iMac internal HDD fails, I still have the TM backups. I also backup yearly photos to DVDs. Photos are irreplaceble, you know.

  • Read file and store the file into a string

    i want to read the file and copy it to a string.
    i wrote this code but don't know what to do next..
    please help me urgent.....
    File file_to_text = new File("c:\\wtgapp.xml");
    String wtgapp_string=new String();
    try
    BufferedInputStream stream = new BufferedInputStream(new FileInputStream(file_to_text));
    catch (FileNotFoundException file_error)
    JOptionPane.showMessageDialog(null, "FILE READ ERROR", "READ ERROR!",JOptionPane.INFORMATION_MESSAGE );
    System.exit(1);
    }

    BufferedReader reader = new BufferedReader(new FileReader(file_to_text));
    try
    while(reader.readLine() !=)
    wtgapp_string = wtgapp_string+ reader.readLine();
    System.out.println(wtgapp_string);
    i did this..
    but reader.readLine() != null
    didn't work.
    what shoud i write? to go to the end of file
    no it is 16.00pm in here i live in TURKIYE istanbul :)

  • ITunes startup and store issues "file already exists"

    Hi there,
    I got a problem with iTunes starting up and i cant solve it with the suggestions available in the handbooks or discussion forums.
    A) When i start up itunes i get an error message saying "the file already exists".
    I can then browse my music and shop as usual.
    B) When i try to buy something in the store a similar error message pops up, "File already existent"
    What i tried so far:
    - Deinstalled itunes and all other Apple producs + associated files and folders.
    - System checkup incl. viruses and various cleanups
    Operating System is Windows 7.
    My Devices work on other machines without any problems.
    Anyone has a solution for what file might be existent or where else the problem can be?
    Thanks so much!

    Hello Cuprastar,
    Thank you for using Apple Support Communities!
    It sounds like these error messages are indicating there could be a problem with the iTunes library itself.
    I would recommend recreating the iTunes library with the help of this article:
    iTunes: How to re-create your iTunes library and playlists
    http://support.apple.com/kb/ht1451
    When you do this, iTunes will offer to scan for media files, and you should let it perform the scan.
    Take care,
    Sterling

Maybe you are looking for