• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Image Capture, Buffered Image, Paste in MSWord 2007 problem

 
Tarun Bolla
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have asked a related question before...but there was no reply. I dont know how to revoke it (may get an answer this time).. so i thought i would ask again..

I am changing the problem statement a bit.
Consider the following code for capturing a part of the screen

Now after running the code, a small part of screen will be captured to clipboard. Paste the same content in mspaint, msword 2007. Paint renders it correctly. Word blurs it. Why is it so and how can i correct it? Thanks in advance folks....
My prev ques link : http://www.coderanch.com/t/542443/GUI/java/Manipulating-BufferedImage-dpi-related
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
run your program, paste into word.
now right-click the image and select 'Edit Picture'

without doing anything else, the image 'sharpens' to that of 'paint' i.e. what you want.

strange, so it is likely to be something to do with word 2007.
 
Tarun Bolla
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Michael, you are right! Thank you!
So do we have any specifications on how the image data in clipboard should be before pasting in word??
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> So do we have any specifications on how the image data in clipboard should be before pasting in word??

I think it's more to do with how it's pasted - instead of paste, try 'paste special' and select the default png or bitmap,
they all seem to work OK.
 
Darryl Burke
Bartender
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Word has some settings related to image compression. Maybe changing the default there will make a difference.

1) Have you tried copying from Paint and pasting in Word? What result do you get?
2) This obviously isn't a Swing problem at all -- I think you should ask the question in a Microsoft forum.
 
Tarun Bolla
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah Darryl Burke, After pasting the image to paint, If i re-copy it from paint and paste it to MSWord, the image remains sharp. The problem is only with direct pasting into MSWord, Outlook etc.,
Edit: I think apart from the normal image data in clipboard, we should maintain some extra metadata in clipboard, which i have no idea on how to start
 
Darryl Burke
Bartender
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah ok. Then try painting the captured Image to different BufferedImage types before setting it on the clipboard. Some might give better results than others.
 
Tarun Bolla
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:Then try painting the captured Image to different BufferedImage types before setting it on the clipboard

No luck with that Darryl Burke. I tried all types of BufferedImage. But somewhere in the internet i read that windows supports images of format DIB, BITMAP on the clipboard. Unfortunately java will not support either. So i think i must read the specification of DIB or BITMAP and generate it. Ok, i can do that, but which Class Object should i create for that purpose? How do i send it to clipboard? What do you think? And i dont want to use JAI
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as I mentioned earlier, paste special works fine.

is there a reason ctrl-alt-V + [enter], instead of ctrl-V, is a problem?
 
Tarun Bolla
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote: is there a reason ctrl-alt-V + [enter], instead of ctrl-V, is a problem?

I am trying to develop a set of nifty tools in which screen capture is one. I cant tell people who use it to do "paste special" instead of "paste".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic