Making a composite of 2 images, it lose all the colors

Hello, Thanks for reading me.
I'm trying to make a composite of 2 images (link_down, link_top) and when I'm making the composite it lose all the colors, I don't know why, please can anybody help me?
here are the images:
down= http://img234.imageshack.us/img234/9571/87453416io0.jpg
top= http://img71.imageshack.us/img71/7305/otraft7.png
output= http://img229.imageshack.us/img229/7796/outputjn0.jpg
and here is the code, please someone could help me?
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
public class ImageMaker {
     public static BufferedImage rotate(BufferedImage img, int angle) throws Exception{
          int w = img.getWidth();
          int h = img.getHeight();
          BufferedImage img2=ImageIO.read(new File("/tmp/top.png"));
          BufferedImage dimg = new BufferedImage(w, h, img.getType());
          Graphics2D g = dimg.createGraphics();
          g.drawImage(img, null, 0, 0);
          g.drawImage(img2,null, 20, 20);
          ImageIO.write(dimg, "jpg", new File("/tmp/output.jpg"));
          return dimg;
     public static BufferedImage createImage() {
          BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
          img.createGraphics();
          Graphics2D g = (Graphics2D)img.getGraphics();
          g.setColor(Color.YELLOW);
          g.fillRect(0, 0, 100, 100);
          for(int i = 1; i < 49; i++) {
               g.setColor(new Color(5*i, 5*i, 4+1*2+i*3));
               g.fillRect(2*i, 2*i, 3*i, 3*1);
          return img;
     public static void main(String[] args) {
          JFrame frame = new JFrame("Image Maker");
          frame.addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent event) {
                    System.exit(0);
          try{
          BufferedImage a=ImageIO.read(new File("/tmp/down.jpg"));
          frame.setBounds(0, 0, 200, 200);
          //JImagePanel panel = new JImagePanel(createImage(), 50, 45);
          JImagePanel panel = new JImagePanel(rotate(a,30), 50, 45);
          frame.add(panel);
          frame.setVisible(true);
          }catch(Exception e)
               System.out.println("Salida:"+e.toString());
import java.awt.Graphics;
//import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;
public class JImagePanel extends JPanel{
     private BufferedImage image;
     int x, y;
     public JImagePanel(BufferedImage image, int x, int y) {
          super();
          this.image = image;
          this.x = x;
          this.y = y;
     @Override
     protected void paintComponent(Graphics g) {
          super.paintComponent(g);
          g.drawImage(image, x, y, null);
}

Try replacing
BufferedImage dimg = new BufferedImage(w, h, img.getType());with
BufferedImage dimg = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);Looks like your "down"-image is grayscale, and therefore also dimg.

Similar Messages

  • Image based of all the colors currently in the swatch

    Are there anyone who know a method or script that enables generation of an image based of all the colors currently in the swatch?
    I would want it to fill a grid, with a patch of the color with the colors name underneath it, and with the name of the swatch as a header on a black background. Maybe even with the lab, cmyk and rgb values underneath each color.
    The colors need to be arranged in the same manner as in the swatch.
    Any help would be appreciated.

    I'm sure this is possible, but you might want to post this in the scripting forum or on ps-scripts.com.  Here is a link to a topic along the lines that you want on ps-scripts.com:
    http://www.ps-scripts.com/bb/viewtopic.php?t=5161

  • Nokia Image Store thinks all the pics on my phone ...

    Hi,
    Today Nokia Image Store (PC Suite 6.84.10.3) is trying to transfer all the images on my phone (Nokia 6682) to my computer. I have tried rebooting my computer and my phone and it didn't help. I have about 500 pics on my phone and want to avoid transferring them all again.
    Is there a way to correct this problem (i.e. remind Image Store that all the pics from my phone have already been transferred)?
    Thank you.
    Asa

    Thanks. It was already setup to use a subdirectory with the transfer date.. I shave sucked it in and followed your suggestion to just let it copy them again. Not such a big deal I guess

  • I have an iphone 4 (ios 4.3.1). I want to update to the latest ios, but it wouldn't load onto my iphone, I got error message code 3014. I tried again and it said I would lose all the contents on my iphone if I continued - help!

    I have an iPhone 4 (IOS 4.3.1) and it was synced and backed up today.
    I wanted to upgrade to the latest ios on iTunes (today's date is 3rd Jan 2013), it seemed to download ok (it took about 30 minutes or so), but when it tried to update onto the iPhone (I think this was what it was doing!) I got an error message that had code 3014 in it. Nowhere on Apple's website can I find a way to resolve this error code.
    I then thought I would just try again from the beginning, but I then got an error message saying that if I continued I would lose all the contents on my iPhone so I cancelled it as I don't want to lose everything on my phone.
    Can anyone help me as I am not very good at technical things and I really want to upgrade the ios on my iPhone without losing all the data I have on there already. An idiots guide would be great.
    Thanks.

    Errors 3000-3999 (3004, 3013, 3014, 3018, 3164, 3194, and so on): Error codes in the 3000 range generally mean that iTunes cannot contact the update server (gs.apple.com) on ports 80 or 443.
    Update to the latest version of iTunes.
    Verify the computer's date and time are accurate.
    Check that your security or firewall software is not interfering with ports 80 or 443, or with the server gs.apple.com.
    Follow Troubleshooting security software. Often, uninstalling third-party security software will resolve these errors.
    An entry in your hosts file may be redirecting requests to gs.apple.com (see "Unable to contact the iOS software update server gs.apple.com" above).
    Internet proxy settings can cause this issue. If you are using a proxy, try without using one.
    Test restoring while connected to a known-good network.

  • If I create a new apple ID will I lose all the apps I have purchased with my original ID?

    If I create a new apple ID will I lose all the apps I have purchased with my original ID?

    I set up FaceTime and Messages on four different devices with only one Apple ID. I used the exact method that is described in the video that AnaMusic has provided to you in the link in her response above.  That method worked fine for my family, but you can create new Apple ID's just to use for FaceTime and Messages if you like. Many users prefer doing that as opposed to adding new email addresses.
    IMO - using unique email addresses (like in the video) makes sense, because we (my family) all have different email addresses anyway, and it was very simple to add each family members email address to both apps and remove my Apple ID email address as the contact address on each device.
    BTW .... if you are using your Apple ID on both devices - your phone number should be the number that is showing in the settings - not you daughter's. Did you set up the Apps with your Apple ID?

  • My computer didn't reconize my ipod, it tell me I hav conect with another biblio,but I never put it in another computer.How I can't  lose all the game on my ipod because itune want to erase my ipod and sync.What I can save the game in my Ipod to computer

    My computer didn't reconize my ipod, It tell me I have syncr with a another biblio, but I nerver put it in another computer. How I can't lose all the game on my ipod because itune want to erase my ipod and sync, What I can do tosave

    My computer didn't reconize my ipod, It tell me I have syncr with a another biblio, but I nerver put it in another computer. How I can't lose all the game on my ipod because itune want to erase my ipod and sync, What I can do tosave

  • I recently purchased songs from itunes via my pc and I dont know how to get them onto my iphone? When I click the sync button it says I will lose all the music currently on my iphone.. Help :(

    I recently purchased songs from itunes via my pc and I dont know how to get them onto my iphone? When I click the sync button it says I will lose all the music currently on my iphone.. Help

    If you're syncing with a different iTunes library than the one you previously synced with, then there is no way around it. You're gonna loose the old data. The only way round it would be to make sure that all the music files on your iPhone is also in your iTunes library. If you still have access to the computer with the old library, you could copy the files on to an external harddrive, and then import them into your new iTunes library.
    If it is in fact the same library, then the music currently on your iphone, is also in your itunes library. Just make sure that the artists/albums/playlists, or whatever you sync contains these tracks, that you allready have on your phone and don't want deleted. What i do is, i create a playlist specifically for my iPhone, and i set it up to only sync with this playlist. Whenever i hear a track from my iTunes library or buy a new track that i want on my phone, i just drag it to this playlist and next time i synchronize, it's there without deleting anything else.

  • I just bought a new computer and when i click on itunes it says i need to install ASL.dll, but i'm scared if i instal it or reinstall itunes i will lose all the music i've bought from itunes, what do i do?

    HHHHHEEEEEEEEEELLLLLLLPPPPPPPPPPPP!!!!!!!!!!!!!!!!!!i just bought a new computer and when i click on itunes it says i need to install ASL.dll, but i'm scared if i do or re-install itunes i will lose all the music i have bought from itunes, what do i do?

    Welcome to the Apple Support Communities
    The music is stored on the iTunes library. This library isn't deleted when you uninstall or reinstall iTunes, so you will keep everything. Anyway, it's better to make a backup of the library. Apart from that, you can download the purchased music as many times as you want

  • MY hard drive crashed and I had to replace it. Now when I try to sync my iPod with iTunes it says that I have to replace the old library (that is lost forever) with the new library to sync. I do not want to lose all the songs on my iPod! What can I do?

    MY hard drive crashed and I had to replace it. Now when I try to sync my iPod with iTunes it says that I have to replace the old library (that is lost forever) with the new library to sync. I do not want to lose all the songs on my iPod! What can I do?

    Copy all the content on your iPod back to your PC and into iTunes. Then go ahead and sync the iPod with your new library.
    See this older post from another forum member Zevoneer covering the different methods and software available to assist you with the task of copying content from your iPod back to your PC and into iTunes.
    https://discussions.apple.com/thread/2452022?start=0&tstart=0
    B-rock

  • Hi, I need to re-format my hard drive, as it has a virus, so will lose all my data including itunes. I therefore need to reinstall itunes - but if I do this will I lose all the music that I have bought? How do I reinstall music to the new itunes?

    Hi, I need to re-format my hard drive, as it has a virus and is corrupted- so I will lose all my data including my itunes software. I guess I will need to reinstall itunes again - but if I do this will, I lose all the music that I have bought or imported into my library? How do I reinstall my library/playlists to the new itunes?
    Thanks

    Make a backup of your media and other important files.
    Just to be safe, make a backup of your entire iTunes directory.
    Restore computer or do whatever it is you need to do.
    Restore your media and other important documents.
    Install iTunes.
    Try using search next time... this gets asked way too frequently.

  • On my screen the image is clear and the colors are right, However when I print to either my epson of HP the image color is off.

    On my Mac screen my photo image is clear and the color are right, however when I print to either my epson 2200 or my HP printer bother the colors are off and the image is not as clear as on the screen.

    Hi there,
    This article should cover the issue you are experiencing. Give the steps outlined a shot and let us know if it helps.
    Best of Luck!
    You can say thanks by clicking the Kudos Star in my post. If my post resolves your problem, please mark it as Accepted Solution so others can benefit too.

  • I was trying to update sofwatare for my iphone 4s, i got stuck with recovery mode and only option i see is to restore from factory setting. Do i lose all the the datas ? i did't had any backup. What is a solution?

    I was trying to update sofwatare for my iphone 4s, i got stuck with recovery mode and only option i see is to restore from factory setting. Do i lose all the the datas ? i did't had any backup. What is a solution?

    If you didn't back it up, your data is gone. There is no "solution" after the fact.

  • Images open showing grid, not all the colors

    Hello:
    I'm having a problem opening my images.  When I select open and select an image, it just opens with the square grey & white blocks in a grid.  The only way I can get the image to fully show with color is when I go to the channels on the lower right, and constantly select Ctrl+2 on the keyboard, for the image to then come in.  I should not have to do this, it should open with all the colors showing up front.
    Can someone help me where I can just open an image w/o manually selecting the color channels everytime?  Thanks.
    Photoshop CS5

    The grid indicates transparency everywhere so is the Opacity set to 0 or have you applied a Layer Mask with Hide Everything set?  Do another screen capture with the Layers pallet visible instead of Channels.
    If the Layers are setup correctly, have you tried turning off OpenGL in Edit / Preferences / Performance?  There may be some incompatibility with your video card or its drivers.
    Did things used to work and suddenly stopped?  Have you updated to PS CS5 12.0.3 recently? 
    Another odd thing is that your image is indicated as being 1280x1024 in the tab-title area, but the onscreen representation appears square.

  • Whenever my new iMac updates or is shutdown, I lose all the Bookmarks that I've created in Safari are gone.  Anyone know how to prevent this?

    Several times now I have created a Bookmark list in Safari but everytime the iMac updates the software, or I shut the computer down, I lose all the Bookmarks.  Only the pre-installed Bookmarks remain.  Does anyone know how to keep this from happening?

    Try resetting PRAM.
    Reset PRAM.  http://support.apple.com/kb/PH4405
    Best.

  • I want to update from 10.4.11 to at least 10.5 but am worried I will lose all the files/apps/iPhoto's etc. will this happen?

    I need to update my iTunes in order to use Apple TV and so that i can use icloud with my MacBook(I have an iPad and iPhone)
    I have worked out in order to do this I need at least to have 10.5. I want to check that I won't lose all the apps, files, photos etc. on my computer if I upgrade to this? Do i need to clear everything before i install10.5?
    I have read that if I jump to 10.6 rather than 10.5 I will lose everything on computer. Is this true?

    Before you do anything make a cloned backup of your system on an external, erased HDD:
    Clone using Restore Option of Disk Utility
      1. Open Disk Utility in the Utilities folder.
      2. Select the Destination volume from the left side list.
      3. Click on the Restore tab in the DU main window.
      4. Select the Destination volume from the left side list and drag it to the Destination
          entry field.
      5. Select the Source volume from the left side list and drag it to the Source entry field.
      6. Check the box, if present, to first Erase the Destination drive.
      6. Double-check you got it right, then click on the Restore button.
    Destination means the external backup drive. Source means the internal startup drive.
    You may then do an Erase and Install of Snow Leopard before moving to anything later.
    Drive Preparation
    1. Boot from your Snow Leopard Installer Disc. After the installer loads select your language and click on the Continue button.  When the menu bar appears select Disk Utility from the Utilities menu.
    2. After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Note the SMART status of the drive in DU's status area.  If it does not say "Verified" then the drive is failing or has failed and will need replacing.  SMART info will not be reported  on external drives. Otherwise, click on the Partition tab in the DU main window.
    3. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Click on the Options button, set the partition scheme to GUID then click on the OK button. Set the format type to Mac OS Extended (Journaled.) Click on the Partition button and wait until the process has completed.
    4. Quit DU and return to the installer. Complete the Snow Leopard installation.
    You can purchase Snow Leopard by contacting Customer Service: Contacting Apple for support and service - this includes international calling numbers. The price is $19.99 plus tax. You will receive physical media - DVD - by mail.
    After you install Snow Leopard you will have to download and install the Mac OS X 10.6.8 Update Combo v1.1 to update Snow Leopard to 10.6.8 and give you access to the App Store.
    Snow Leopard General requirements
      1. Mac computer with an Intel processor
      2. 1GB of memory
      3. 5GB of available disk space
      4. DVD drive for installation
      5. Some features require a compatible Internet service provider; fees may apply.
      6. Some features require Apple’s MobileMe service; fees and terms apply.

Maybe you are looking for

  • Ipod is not Recognized by Mac.

    I have a third generation Ipod, it is three years old. I recently charged it with an outlet charger and not by my computer. Now the ipod says that i need to connect my Ipod to my computer to reset it, but when i connect it to my mac it doesn't recogn

  • First Workflow

    Hi, I am very new to Workflow and have just read few basics etc. Now I have been assigned to create some notifications etc for my project. But I am stuck in the initial point only. Beow is the description of the same. Actually I have created a workfl

  • How do I remove older Apple ID I'm no longer using on my Mac?

    I cannot use App Store to get updates because security has disabled my "older" Apple ID.  But it's greyed out and I can't log in with my new/current Apple ID.  Originally I had a .me iCloud account with a different email address when I got this compu

  • PC won't update itunes11, and doesn't see Iphone-5 w/new ios software

    I have viewed many of the discussions relating to this common problem of itunes not seeing the iphone5 with the updated ios7 software. None of the fixes listed in the discussions have worked so far.  Here is what has occured:  1) Reloaded apple drive

  • After Efftect to FCP color Shift

    I am compositing video from FCP in After Effects out put back to FCP matching formats and get the RGB to YUV color shift. I understand why but not how to correct the problem. I have tried the sequence setting and selected render in RGB but the releat