Need help on transforming a bufferedimage back to an image

Hi,
for a project in school, I need to read in a .jpeg file, transform it to a bufferedimage, getting the pixels. Then I make a new bufferedimage and all the RGB values that are higher then a certain (changeable) contrast value are made white, the other black (so basicly i transform an image to black and white) (with getRGB from colorimage and setRGB to the new bufferedimage)
But I have trouble to transform the black and white bufferedimage to an image for viewing the image...
The code for that part is like this:
public void beeldWeergeven(){
     for (int j=0;j>height;j++){
          for (int i=0;i<width;i++){
               waarde = zwartwitmatrix[j][i]*255;
               imagezw.setRGB(i,j,waarde);
     Image zwimage = toImage(imagezw);
     zwimage = null;{
     JFrame frame = new JFrame();
JLabel label = new JLabel(new ImageIcon(zwimage));
frame.getContentPane().add(label, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
public static Image toImage(BufferedImage bufferedImage) {
return Toolkit.getDefaultToolkit().createImage(bufferedImage.getSource());
When I compile, I always get a nullpointerexception
I'm not that good at writing java, so if anyone could lend me a hand on this :)

For the moment (guess you know there are other ways to Black and White anyway):
for (int j=0;j>height;j++)
should be
for (int j=0;j<height;j++)
possibly??

Similar Messages

  • I have updated my iphone this evening and is has asked me to connect my phone to itunes, I connected it to a computer with itunes and it says it needs restoring? and all my images etcwill be earsed I need help as I have not backed my iphone up previously

    I have updated my iphone this evening and is has asked me to connect my phone to itunes, I connected it to a computer with itunes and it says it needs restoring? and all my images etcwill be earsed I need help as I have not backed my iphone up previously please help?

    YOur phone is in recovery mode, any data that was on there is already gone, you will have to restore your phone and use whatever backup you to restore to.

  • I need help with a PDF file that is an image, the "Read Out Loud' option does not work, please help!

    I need help with a PDF file that is an image, the "Read Out Loud' option does not work, please help!

    You mean an image such as a scanned document?
    If that is the case, the file doesn't contain any text for Reader Out Loud to read. In order to fix that, you would need an application such as Adobe Acrobat that does Optical Character Recognition to convert the images to actual text.
    You can also try to export the file as a Word document or something else using ExportPDF which I believe offers OCR and is cheaper than Acrobat.

  • I need help Centering a div box to a background image using dreamweaver cs5.5.

    I need help Centering a div box to a background image using dreamweaver cs5.5. Everything shift left when viewing on different size monitors?  See what I mean at
    www.woodlandhospice.com

    Have you looked at your page with images disabled?
    I urge you to re-think this approach to web design because images of text are not indexed by search engines, screen readers or translators.  Given the demographic group your site is targeting, you really need to ensure maximum web accessibility for all users.
    Navigation, headings and descriptions all need to be in real text -- not images of text.
    Ken is right.  Absolute positioning is pure poison for such a simple layout.  My advice is to start over with one of the pre-built Starter Pages in DW.  Go to File > New > Blank page > HTML.  Select a layout from the 3rd column and hit CREATE button.
    Nancy O.

  • Need help in transformation

    Hi All,
        I need a help in transformation.  There are 5 Key figures : KF1, KF2,KF3, KF4 , KF5 in my target.
    Requirement is  KF3 should be KF1 * KF2
    and if KF4 >0 ,  KF5 = KF4.
      else
            KF5 = KF3.
    I am not able to see these key figures when im trying in  formula or routine.
    How can I do these in transformations ???
    Thanks in advance..

    Hi All,
      Thanks for your inputs .
    I have used end routine for this requirement as the field level transformation will become complex as the (already present KFs in target are derived from the routines)..
    So  I have used end routine,
    Data: lwa_result_package like line of result_package.
    loop at result_package into lwa_result_package.
    lwa_result_package-/BIC/zval_chng = lwa_result_package-/BIC/zpri_new * lwa_result_package-/BIC/z_qty_new -
                                   lwa_result_package-/BIC/zpri_old * lwa_result_package-/BIC/z_qty_old.
    if lwa_result_package-/BIC/zval_chng is not initial.
    lwa_result_package-/BIC/ztot_amnt = lwa_result_package-/BIC/zval_chng.
    else.
    lwa_result_package-/BIC/ztot_amnt = lwa_result_package-/BIC/znetprice.
    endif.
    MODIFY result_package from lwa_result_package.
    endloop.
    Thanks again for your posts..

  • I really need help in getting my music back my hard drive crashed

    I need help in re-downloading my music i bought, My computer's hard drive crashed last week an i finally got a new one an i spent like 30$ on music an videos, so i was wondering how to get them back... Im lost without out my music please help me

    Either restore the media from the backup of the computer or redownload via iTunes. http://support.apple.com/kb/ht2519

  • I need help trying to print ,move and resize multiple images on a page to print!help!

    can anyone give me to some advice. I was using an older version of photoshop elements where i could position the image i wanted to print on the page. I could resize it, move it around and add more photo's. I print small images that I cut out for jewelry making and need to be able to add 12 small images to a 4x6 print size page. My new elements is not allowing me to do that! I'm frustrated and need help!! thanks!

    It should work just the same as before: create a blank document, place your images on it, then print it. The only difference is that you can't change the position of the image in the print window anymore.

  • After reverting back to Garageband 6.0, I find that I still lack all the Garageband Effects (Distortion, Vocal Transformer, etc.). The Garageband 10 "AU" plug ins are there instead. I need help getting the old effects back.

    For background: I lost my v6 because I had to reformat my whole hard drive. When I reformatted I lost GB and everything else I had. I downloaded GB (unaware of the awfulness that is v10) from the App Store. The fact that v10 does not have all my favorite and most used effects from v6, I uninstalled v10 and redownloaded v6 from my App Store Purchases. I load up v6 only to find that all the default effects are there for each instrument, but when I go to add an effect (i.e. Distortion, Vocal Transformer, Flanger, etc.), instead of the list of classic effects, there's the list of awful AU effects from v10. What gives?!

    I uninstalled v10 and redownloaded v6 from my App Store Purchases. I load up v6 only to find that all the default effects are there for each instrument, but when I go to add an effect (i.e. Distortion, Vocal Transformer, Flanger, etc.), instead of the list of classic effects, there's the list of awful AU effects from v10. What gives?!
    For me, the "Edit" panel in GB6.0.5 looks like this:
    Are you saying, that the upper part with "GarageBand Effects" is missing?
    Then check, what is installed in your System Library in the folder
    /Library/Application Support/GarageBand/Instrument Library/
    (the topmost "Library" folder on your Hard Drive.
    You may need to restore the old GarageBand effects and Track settings files from your backup:
    i.e look into the folder /Library/Application Support/GarageBand/Instrument Library/Plug-In Settings/
    and restore the settings for Chorus, Flanger, Vocal Transformer, Tremolo, whatever effects you are missing.
    And also look for missing files in "Track Settings" folder and "Sampler" folder.
    What kind of backup do you have? If you have a Time MAchine backup, go back in time to the time before you upgraded to GB 10.
    Regards
    Léonie

  • TS5249 After reverting back to Garageband 6.0, I find that I still lack all the Garageband Effects (Distortion, Vocal Transformer, etc.). The Garageband 10 "AU" plug ins are there instead. I need help getting the old effects back.

    After reverting back to Garageband 6.0, I find that I still lack all the Garageband Effects (Distortion, Vocal Transformer, etc.). The Garageband 10 "AU" plug ins are there instead.
    For background: I lost my v6 because I had to reformat my whole hard drive. When I reformatted I lost GB and everything else I had. I downloaded GB (unaware of the awfulness that is v10) from the App Store. The fact that v10 does not have all my favorite and most used effects from v6, I uninstalled v10 and redownloaded v6 from my App Store Purchases. I load up v6 only to find that all the default effects are there for each instrument, but when I go to add an effect (i.e. Distortion, Vocal Transformer, Flanger, etc.), instead of the list of classic effects, there's the list of awful AU effects from v10. What gives?!

    I don’t have this issue, but I am looking to learn about which parts of the old GarageBand can safely migrate to the new GarageBand 10. 
    (Personally, I like most of what changed in the new version.  I sorely miss a few features, and I submitted some detailed feedback.  If you think similarly—or if you hate the new version like babygotbackup—do the GarageBand community a favor, and send in your own feedback!  From the menu, select GarageBand ▶︎ Provide GarageBand Feedback.)

  • Calendar in iCloud deleted - need help to get the data back

    Hi,
    I just deleted one of my calendars in iCloud. Is there any chance to get this calendar (with all the data) back into iCloud?
    Thanks for your help.
    Pierre

    how? I should have a backup at my time machine from earlier today. Do I need to completely restore my MBP to also get my calender data back? Note that i only by accident deleted one calender (my others are ok)
    thank you

  • Need help in printing text at back page using XML Publisher

    Hi,
    I need to print instructions (static text) at the back page of my report ouput using XML publisher. Oracle Application used is 11.5.10. Please help me to reslove.

    Hi,
    Did you see "Oracle XML Publisher User's Guide" manual available at --> http://www.oracle.com/technology/documentation/applications.html
    Regards,
    Hussein

  • Need help with LaCie d2 and back-ups

    I have a new MacBook running 10.4.9 and a Flat Panel iMac running 10.3.9 and 9.2.2 (for a couple of old games). Today I updated my LaCie firmware with the hopes of backing up my MacBook. The 120 GB LaCie has 4 partitions, 1 empty, 2 with 10.3.9 backups and one with a 9.2.2 backup. My plan was to erase the LaCie and repartition so that I would have 3 partitions: one for 10.4.9, one for 10.3.9 and one for 9.2.2. My flatpanel recognizes the LaCie volumes as bootable (they show up when I start while holding down the option key and I can see them in System Preferenes as start-up disks). My MacBook mounts the LaCie volumes, I can see them in disk utitility but they do not show up when I hold down the option key nor can I see them in System Preferences as start up disks. Is this normal? Will my 3 partition plan work? In order to backup my MacBook would I just need to start up from the Tiger CD and then use disk utility to clone a copy? I have read about SuperDuper and have it on my MacBook but I wouldn't be able to use that if booted from the CD, right?
    As you can tell, I am a very BASIC Mac user, so please talk down to me. I am NERVOUS about wiping my LaCie--like working without a net! I also want to repartition my flat panel to 2 partitions rather than 3, if I ever get this figured out.
    TIA for your patience and help.
    MacBook Mac OS X (10.4.9) iMac Flat Panel and LaCie d2
    iMac Flat Panel

    Just a couple of things. A bootable OS needs to be installed on a volume/partition before it appears in Startup Disk. Additinally, you'll need to partition the LaCie with the MacBook, since Panther's Disk Utility doesn't know anything about the required GUID partition map scheme. Finally, note that Panther and OS 9 can't use the GUID scheme. The See my post at http://discussions.apple.com/message.jspa?messageID=4511447 for details.

  • I need help getting my purchased music back please

    I'm pretty sure i have somehow deleted a lot of music from my itunes and computer accidentally. I am only bothered about getting my purchased music back, most of which now has a grey exclamation mark next to it and says it cannot be located. I have the purchased music on my ipod, which it plays fine on and have tried to put it back on to my itunes by selecting transfer purchases although this only transferred 18 of my purchased songs. Unfortunately my external hard-drive doesn't work anymore and i haven't got the music backed up anywhere else.
    Being a student i can't afford to pay for it all again or take a 4 hour round trip to my closest apple store so i am hoping someone online could help me, thank you.

    check this post by Zevoneer.
    JGG

  • I Need Help with Sending My Ipod Back!

    I need to send my ipod back because I think the headphone connector is broken but I'm confused. When go to the page where you send it back it asks you some questions. At the start it asks you if you need to replace a part or the whole thing...whick should I chose? Also at one part it asks you what's wrong with the ipod. It has a drop down menu and i'm not sure what to put. Also after that it asks you which faulty accessory you have. What happens when you don't have a faulty accessory or you don't know what's wrong with it? What else would a headphone connector be called...sorry i'm really thick

    If you have used your iPod with other headphones and it still won't work then you would need the whole iPod replaced.
    So...
    1) Repair whole unit
    2) For select an issue, click Sound Quality
    You should be able to complete the rest of the form.
    btabz

  • I need help with boot camp. "Back up the disk and use Disk Utility to format it as a single Mac OS Extended (Journaled) volume. Restore your information to the disk and try using Boot Camp Assistant again."

    This message appears every time I try to partition my disk:
    "Back up the disk and use Disk Utility to format it as a single Mac OS Extended (Journaled) volume. Restore your information to the disk and try using Boot Camp Assistant again."
    I verified my Macintosh HD disk on Disk utility and then tried to repair it, but I am unable to click the repair button.
    It says it's not available because the startup disk is selected.
    I don't know what to do or how to go about both these problems.
    Please, any suggestions?

    This message appears every time I try to partition my disk:
    "Back up the disk and use Disk Utility to format it as a single Mac OS Extended (Journaled) volume. Restore your information to the disk and try using Boot Camp Assistant again."
    I verified my Macintosh HD disk on Disk utility and then tried to repair it, but I am unable to click the repair button.
    It says it's not available because the startup disk is selected.
    I don't know what to do or how to go about both these problems.
    Please, any suggestions?

Maybe you are looking for

  • Excel 2003+ exports are actually being saved as .mhtml documents. How to export as true .xls?

    Hi All, I am new to OBIEE and was confused about why exporting report views to Excel renders them as .mhtml documents. I am using version 11.1.1.5.0 What I have tried doing so far is this: Open Dashboard Click 'Export' link under my target Analysis w

  • IOS 8 Bluetooth problem in '13 Honda Accord

    Ever since upgrading to iOS 8 on my iPhone 5s, I am unable to speak on the phone through the Bluetooth system in my 2013 Honda. The phone will connect, but when I try to make a call, the call can not be heard through the Bluetooth unless I switch the

  • How to Configure Sample Order

    Can any one tell me configuration steps for configuring sample order type in sap Sd anand

  • Music Videos won't load

    I have tried several times to get the music videos in my music video playlist to load onto my iPod, but it's not working. The videos look like they're in the right format and I think I have the right settings in iTunes. Thanks!

  • How do i cancel a "not available" podcast download?

    hey there I wanted to download 2 podcasts and i keep getting a message that the podcast  can not be downloaded, so i want to get rid of it! But they keeps standing in my download. Who can help me? Ref: podcast:"stephen king movie club - the langolier