JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java SE 討論區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 擷取螢幕畫面的範例程式 URL [精華]
JiaYun



版主

發文: 761
積分: 9
於 2003-07-11 23:12 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
http://www.geocities.com/SiliconValley/Lakes/6686/java-save-screenshot.html

還好不少好東西的樣子 Big Smile


reply to postreply to post
作者 Re:擷取螢幕畫面的範例程式 URL [Re:JiaYun]
kevinlin0730





發文: 1
積分: 0
於 2006-11-05 23:54 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
該連結已改為
http://schmidt.devlib.org/java/save-screenshot.html


reply to postreply to post
作者 Re:擷取螢幕畫面的範例程式 URL [Re:kevinlin0730]
linbn





發文: 4
積分: 0
於 2006-11-10 08:23 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
kevinlin0730 wrote:
該連結已改為
http://schmidt.devlib.org/java/save-screenshot.html


感謝分享...

這範例真棒,可以改寫成其他有趣的東西


reply to postreply to post
作者 Re:擷取螢幕畫面的範例程式 URL [Re:JiaYun]
arifkz





發文: 28
積分: 1
於 2006-11-10 23:19 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
多謝版主分享....早就想擷取螢幕很久了 ^^

只是一直沒時間研究

先收下啦.....


reply to postreply to post
作者 Re:擷取螢幕畫面的範例程式 URL [Re:JiaYun]
arifkz





發文: 28
積分: 1
於 2006-11-10 23:23 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
剛剛玩了一下~~~還蠻有趣的
想玩的版友可以試一下

不過要餵兩個外部參數進去
第一個是設定擷取幾秒後的螢幕畫面
第二個是輸出的檔案名稱...

純粹提供....相信大家應該一下就看出來了吧 ^^


reply to postreply to post
作者 Re:擷取螢幕畫面的範例程式 URL [Re:JiaYun]
chinkaiw





發文: 140
積分: 1
於 2006-11-17 11:10 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
 
public class Test7 implements Runnable{
  Toolkit toolkit;
  Dimension screenSize;
  Rectangle screenRect;
  Robot robot;
  BufferedImage image;
  public static void main(String[] args){
    Thread t = new Thread(new Test7());
    t.start();
  }
  public Test7() {
    // determine current screen size
    toolkit = Toolkit.getDefaultToolkit();
    screenSize = toolkit.getScreenSize();
    //screenSize.setSize(screenSize.getWidth() *1/2, screenSize.getHeight() *1/2);
    screenRect = new Rectangle(screenSize);
    // create screen shot
    try{
      robot = new Robot();
    }catch(Exception e){
      e.printStackTrace();
    }
  }
  public void run(){
    int i = 0 ;
    while (i < 100){
      try{
        
        image = robot.createScreenCapture(screenRect);
        // save captured image to PNG file
        ImageIO.write(image, "jpg", new File("img\\" + i + ".jpg"));
        Thread.sleep(100);
        i++;
      }catch (Exception e){
        e.printStackTrace();
      }
    }
  }
 
}

小弟寫了上面的程式
可以連續擷取螢幕畫面
希望之後能夠將他轉成GIF

做到錄製螢幕動作的功能
但是覺得速度實在是有夠慢

有沒有辦法改善效率呢?
或是有其他方法可以錄製桌面的動作


reply to postreply to post
作者 Re:擷取螢幕畫面的範例程式 URL [Re:JiaYun]
fvawxweaz





發文: 2
積分: 0
於 2007-09-21 19:09 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我儲存的圖片 打開來看顏色怪怪的...
背景應該是白的卻變黑的了
我是畫圖形(直線 方形之類的)在BufferedImage上
然後加上 ImageIO.write(Image,"jpg",new File(filename)) 來儲存這張Image
是存成功了 但裡面的顏色都變了...
可能是什麼原因呢??


reply to postreply to post
作者 Re:擷取螢幕畫面的範例程式 URL [Re:chinkaiw]
a0917009769





發文: 23
積分: 0
於 2011-06-23 14:38 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
如果等迴圈跑完再來進行IO的動作 效能會不會稍微提升呢?

reply to postreply to post
» JWorld@TW »  Java SE 討論區

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8