Paste Images Problem

Hi all,
I'm having a problem pasting images from an external application to my java app. The external app uses the Windows clipboard to copy these proprietary images into a format that is not documented, but as I understand it, Windows uses BMP by default.
The problem is that when the clipboard contents are pasted into my application, the images are offset. Now, if I paste the clipboard contents into another application(Paint.net, Photoshop), this problem does not occur. If I save the pasted image from Photoshop to an 8 bit indexed BMP, reload that image, copy and paste, the problem occurs. If I save it from Photoshop to an 8 bit RGB BMP, reload the image, copy and paste, the problem disapears(no offset). If you don't have Photoshop, the problem can be replicated in the native Windows Paint program.
I've included a small program that demonstrates the problem, as well as two images. The correct.bmp image works fine, incorrect.bmp shows the problem. The are both quite large(1 ~ 5 mb).
Any help would be greatly appreciated.
http://param.us/trophy/correct.bmp
http://param.us/trophy/incorrect.bmp
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
* @author William
public class Main {
     * @param args the command line arguments
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        JPanel panel = new JPanel();
        final JLabel label = new JLabel();
        JButton button = new JButton("Paste");
        button.addActionListener( new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                 final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                  Transferable clipData = clipboard.getContents(clipboard);
                  if (clipData != null) {
                    try {
                      if (clipData.isDataFlavorSupported(DataFlavor.imageFlavor)) {
                          Image image = (BufferedImage)clipData.getTransferData(DataFlavor.imageFlavor); 
                          ImageIcon icon = new ImageIcon(image);
                          label.setIcon(icon);
                    catch( Exception e) {
                        e.printStackTrace();
        panel.add(button);
        panel.add(label);
        frame.getContentPane().add(panel);
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.setSize(300,300);
        frame.setVisible(true);
        // TODO code application logic here
};

I observe the problem, if I copy the images from the windows Paint instead of Chrome.
No, but they will be copying though the proprietary program they are using. It's the only way to get the proprietary images 'converted', so to speak.Can't your 'proprietary program' save the converted images to disk. If that is possible then you can set the icon of the label using the url of the saved image. I have just observed that if you set icon using file path of any of the 'correct.bmp' or 'incorrect.bmp', it displays it fine. However, as already said there is some problem with the copying using clipboard.
Thanks!

Similar Messages

  • Copy-paste images problem

    hello!
    when i'm using safari and i need to copy an image. i click over the image and select copy image NOT copy image adress.
    anyway when i try to paste the image, it only paste the web adress... for example on word:mac or iworks
    thanks for your help!

    Folks
    Welcome to the Apple Discussions.
    This is the Aperture forum, not the Safari one.
    Try Drag and dropping the image from Safari to the desktop or to your target document.
    Regards
    TD

  • Pasted image not printing in Acrobat Pro 9

    I had no problems printing PDF pages with pated into them images in Acrobat 8. Now in version 9 I can still paste the image into the document, save doc and see it on the screen with no problem - but when printing the pasted image is gone. Any clues?

    Found that I must select "Document and stamps" in Print dialog box to have stamps and pasted images printed.

  • Copy and paste image from IE to Illustrator

    Dear Illustrator users,
    I need to copy and paste images from IE10 or IE11 (Internet Explorer) to Illustrator (CS6, CC).
    I right-click image, choose "copy" in Internet Explorer
    now I can paste it to mspaint, word, photoshop, etc. It works fine..
    but when I try to paste image to Illustrator, it pastes url link instead of image.
    I know this problem comes with IE10. When I downgrade to IE9, it start to work fine.
    Any suggestion?
    Kind Regards,
    Jarda

    Hi Jacob,
    Thank you for a quick answer. Your suggestion is correct, but saving image to a file is an additional step.
    Since I do this task "thousands a day", this is unacceptable
    Any other suggestion?
    Regards,
    Jarda

  • Copy/Paste images into Contribute CS3

    We have been copying and pasting images from Word Documents
    in Office 2003 into Contribute CS3 at my organization when
    developing content. We have been able to copy/paste images from
    Office 2003 and other programs like Paintshop Pro and SnagIt.
    Since upgrade to Microsoft Office 2007 all image copying and
    pasting has stopped working.
    Is there a known issue with this?
    Does anyone else have Office 2007 installed and is able to
    copy/paste images from a Word Document into a page in Contribute
    CS3?

    It appears that the problem only occurs if you are copy and
    pasting from something that hasn't been saved yet.
    In Word I inserted an image from my hard drive and tried to
    copy/paste it into Contribute and that failed. I then saved the
    Word Document to my hard drive, re-opened it and was able to
    copy/paste fine.
    Power Point, Snagit and Pain Shop Pro appear to have the
    problem even if it's been saved first.
    I was able to copy/paste an image from a Word Doc and
    PowerPoint into MSPaint just fine. I was also able to copy/paste
    between Office applications with out any problem. Snagit could
    copy/paste into Office just fine and MSPaint.
    This problem appears to be specific to Contribute CS3 but
    only from certain sources.

  • Can't copy and paste images that i've converted from pdf to word

    can't copy and paste images that i've converted from pdf to word

    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!

  • OneNote 2013 - Cannot paste images

    Hello! I have a issue with copying\pasting images in OneNote.
    Example: I have an image on OneNote page. Then i copy or cut image to clipboard. When i try to paste image to any OneNote page,
    only blank space inserts instead of copied image. 
    When i try to paste the same copied image from onenote to paint or word, for example, it works nice.
    Copying\pasting from word\paint to onenote works nice. Text copied as expected.  
    Only copying from OneNote
    to the same OneNote app fails regardless of OneNote page\notebook.. 
    OneNote 2013 (15.0.4535.1507) 32bit.

    Appologize for the mistake in my last reply. Based on my test, Paste(P) is the default and only Paste Options when we copy/paste image from one OneNote page to another.
    Please try to use OneNote /safeboot to clear your local OneNote cache to check the result. To do this, press Windows key + R, type
    OneNote /safeboot in the Run command and press Enter.
    Please first try Delete Notebook Cache.
    Note: When we delete the Notebook cache, you’ll lose your unsynced changes and you’ll have to reopen the notebooks. So please make sure all your changes have been saved before you start OneNote with safeboot.
    If above not fix the problem, please try
    Delete Settings.
    Note: Use Delete Settings will have your OneNote to use default settings, but you can change them later.
    Please let me know the result.
    Regards,
    Steve Fan
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click
    here

  • Pasting images that have been put onto the clipboard by other applications

    I have the following problem. Might be that I am just overlooking something but I haven't found any information or other java programs that would solve this problem.
    I want to access the System Clipboard and retrive images copied onto the System Clipboard by an other application (e.g. paint, irfanView, ... ). Copy and pasting works perfectly with Strings or Images I myself copied to the Clipboard, but as soon as I want to access an image from an other application clipboard.getContents(this) returns null as though the Clipboard was empty. (Where clipboard =getToolkit().getSystemClipboard();)
    I downloaded a couple of other java applications that handle images (e.g. ImageJ) and found out that those also can't paste images from other sources.
    Is there a way to do that? Has anybody found a solution for that or have I really overlooked something, and it's just one of those stupid bugs one never finds by oneself?

    Hi,
    this was exactly my problem. With "Copy and pasting works perfectly with Strings or Images I myself copied to the Clipboard" I mean that I copied the Images and Strings from within a Java Application on to the System Clipboard. It didn't work if the image came from another win32 application. I solved the problem by using JNI, reading the images from the clipboard using C++ and then passing an int[] array to the java application.

  • Copy/paste images into pages within sharepoint online?

    There seems to be a workaround to use RadControl for this. (http://social.msdn.microsoft.com/Forums/en-US/655c080f-ec1e-4e69-b082-d35973ee426a/copy-and-paste-for-images-in-sharepoint)
    However, I don't think we can deploy custom app/binaries onto sharepoint online.
    Is there other way we can easily copy/past images into pages?
    Thx

    you cannot paste the images into sharepoint pages directly, Images cannot be rendered as HTML so cannot be pasted.
    You have to upload the images into SharePoint then insert it on the pages /places you want.
    or other work aorund buy the 3rd party tool which you mentioned.
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • Paste images into wiki pages

    is it possible for a user to
    paste images into SharePoint 2013 wiki pages while editing.
    MP

    there is no OOTB way to do this, you have to insert it from computer or sharepoint. SharePoint needs that image store into the images library.
    other way is embed int the page using HTML tags but this is not recommended.
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/eb49500b-24b4-44df-8532-dcd818f75ce9/copy-paste-pictures-to-wiki-pages-publishing-web-pages?forum=sharepointgeneralprevious
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • TextEdit doesn't paste images

    Hello.
    The problem occurs when i'm trying to paste the content from Chrome browser to TextEdit. Text pastes good, but the images don't display nor as images, nor as links. Snow Leopard didn't have such problem. Can you help me solve this pb? Thx

    I recently have had the same issue copying and pasting from Firefox.
    But with Safari I'm able to copy and paste images together with the text!
    Try!

  • Macbook pro retina with ghost image problem

    Can i claim my retina display that have ghost image problem?

    Hi there, I had the same problem with my Macbook Pro 15`` Retina. And here is how you can find out if you have ghost image problem. There are two retina display manufacturers for Macbook Pro Retina`s LG and Samsung. And if you are luck you will have the Samsung Retina Display on your mac. Here is how you can find the manufacturer for you Macbook.
    Go to your Applications folder and launch Terminal. Paste in the following and hit return:
    ioreg -lw0 | grep "EDID" | sed "/[^<]*</s///" | xxd -p -r | strings -6
    Look at the beginning of the second line to see which manufacturer made your display. If it starts with LP then you have an LG display. Samsung displays start with LSN.
    If your display shows LP you might have this problem for sure. So here is how you can test your screen.
    A simple test to check your Retina MacBook Pro display for image retention also reported as "ghosting"
    http://www.mitchmalone.name/retina-test/
    Run the test for 10 Min. and you will find out if you have this problem.
    And if you have it, and if you are still under waranty the Apple will replace the display with Samsung for free of charge. I hope this information helps.

  • Cannot Paste Image into Photoshop CS4

    I've lost the consistent ability to paste images from otehr applications (e.g. screen captures or web browsers) into Photoshop.It doesn't seem to matter what the source application is (so a screen-cap utility versus alt+prtScrn makes no difference).
    This is issue is plaguing the majority of artists in our game studio.
    It's even happening on new, clean installations. It happens under both XP and Win7.
    The problem is progressive -- it starts mildly, and gets worse over days and weeks (not just during a single session).
    When Photoshop starts, you can always paste at least one external clipboard image into it. After some number of external pastes, however, PS will simply stop importing the contents of the external clipboard, and will just keep pasting its own internal clipboard over and over. The # of pastes keeps getting shorter and shorter as the problem progresses -- for myself and our art director, we can usually only paste ONCE and then have to restart Photoshop. Twenty times a day.
    The "Edit->Purge" menu options are often greyed-out, so that's not an option for fixing.
    Please Help!
    thanks
    kb

    There is a registry tweak that affects Photoshop's clipboard importation process.
    Windows Registry Editor Version 5.00
    [HKEY_CURRENT_USER\Software\Adobe\Photoshop\11.0]
    “AlwaysImportClipboard”=dword:00000001
    Might be worth a try adding that value on your system.
    -Noel

  • Illustrator CS4 no longer allows me to paste images "Quicktime and a decompresser are needed to view this image". How do I fix this?

    Since I installed the Yosemite Mac software upgrade, my Illustrator CS4 no longer allows me to paste images. I get the message "Quicktime and a decompresser are needed to view this image". How do I fix this? I've tried everything, nothing works!!!!

    Did you use migration with the new OS or did you reinstall the CS4 apps from the original media? If you didn't, then you should uninstall CS4 making sure to check the box to remove preferences, run the Cleaner tool (Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6) and then reinstall CS4. CS4 is totally untested and unsupported on the latest versions of Mac OSes.

  • Pasted images in work item HTML fields sometimes get lost

    I have the curious problem that sometimes the images which have been pasted to HTML fields of work item (e.g. Description field) get lost. SQL data analysis showed that this only happens in ~4% of the cases (16 missing, 443 ok).
    When looking at HTML text in field you realize that there are empty image tags.
    <img alt="">
    In correct work items you always (sure!) have correctly set image tags.
    <img style="width:665px;" src="?FileNameGuid=06686f67-9fe1-4a73-8ed3-98b00a20e3e6&amp;FileName=temp1429775841167.png">
    <img height=204 style="width:352px;height:166px;" src="?FileNameGuid=06686f67-9fe1-4a73-8ed3-98b00a20e3e6&amp;FileName=temp1429775841167.png">
    Within web access it then looks like the following when you click into work item field:
    I can't reproduce the behavior. Might it be due to different web browsers (as far as I know IE, Chrome and Firefox are used)?

    Hi Robin,
    Thanks for your post.
    What’s the version of your TFS and VS? 
    According  your description, it seems the image HTML text not stored correctly in TFS database for that work items. If you paste the image the same ‘issue’ work item’s Description field again, the image can shows correctly in this same
    work item?
    Do you mean this issue only happened when you paste image to work item field in TFS Web Access? If you paste image to work item field using VS, all the work items are correctly?
    To resolve this issue, I need to reproduce it in my TFS Server environment, please try to filter out how this issue will happen in work item field in your TFS Server environment.  
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • PO Accruals and closing Purchasing periods

    Hi, can anybody confirm how many purchasing periods should be open at any one time. We are having a problem with the accruals and I am trying to understand the correct procedure for re-setting the purchasing accruals. I am aware that by closing the p

  • New iMac 750 GB Hard Drive Fail Smart Drive Test - Glitch or Problem

    Greetings! I have a new 24" imac with 750 GB hard drive which has had problems out of the box (system crashing several times a day/unable to re-start/application crashes/general sluggishness). Five re-installs of Leopard (upgrade/clean install/instal

  • Zenworks 7 boot cd for an automatic restore

    Hi everyone.... I want to know if it's possible ot create a boot cd and restore an image automatically ( whitout any human intervention ). I want to start a workstation with a Zen7 boot cd and automatically restore an image that i find on a volume on

  • Flex in a week: error Could not resolve s:Application to a component implementation

    Hi All, I've seen other posts mentioning this error but seems no fix has come up. Was just trying out the example project for Flex in a Week and out of the box am stuck on " Could not resolve <s:Application> to a component implementation " the namesp

  • Normalising Sound Levels in iMovie

    Hello, I have an iMovie project which is a video/audio interview between two people. Unfortunately the interviewer's mic is far quieter than the interviewee's. Is there a way that I can normalise the sound levels within iMovie so that the volume is c