David.Turing's blog

           

          發(fā)布GIF4J破解版

          2年前,我提供了一個(gè)GIF4J的可用版,GIF4J是一套針對(duì)gif操作的Java類庫。
          周末無聊,最終破解了Gif4J的"Eval Gif4j"。

          import ?com.gif4j. * ;

          import ?java.awt. * ;
          import ?java.awt.image.BufferedImage;
          import ?java.io.File;
          import ?java.io.IOException;


          public ? class ?GifImageWatermarkExample?{

          ????
          // ?Usage:?java?GifImageWatermarkExample?[PathToGifImageToWatermark]?(please?be?sure?that?the?gif4j?jar?is?in?your?CLASSPATH)
          ????
          // ?By?default?the?gif4j_logotype.gif?as?an?example?gif?image?is?used
          ???? public ? static ? void ?main(String[]?args)?{
          ????????File?gifImageFileToWatermark?
          = ? null ;
          ????????
          if ?(args.length? == ? 0 )?{
          ????????????gifImageFileToWatermark?
          = ? new ?File( " test.gif " );
          ????????}?
          else
          ????????????gifImageFileToWatermark?
          = ? new ?File(args[ 0 ]);

          ????????
          // ?load?and?decode?gif?image
          ????????GifImage?gifImage? = ? null ;
          ????????
          try ?{
          ????????????gifImage?
          = ?GifDecoder.decode(gifImageFileToWatermark);
          ????????}?
          catch ?(IOException?e)?{
          ????????????e.printStackTrace();
          ????????????System.exit(
          1 );
          ????????}

          ????????
          // ?change?out?directory?if?it?is?necessary
          ????????File?outputDir? = ? new ?File( " . " ? + ?File.separator? + ? " result " );
          ????????
          if ?( ! outputDir.exists())
          ????????????outputDir.mkdirs();

          ????????
          // ?create?watermark?image?using?TextPainter
          ????????TextPainter?painter? = ? new ?TextPainter( new ?Font( " Verdana " ,?Font.BOLD,? 10 ));
          ????????painter.setOutlinePaint(Color.WHITE);
          ????????BufferedImage?watermarkImage?
          = ?painter.renderString( " david.turing " ,? true );

          ????????
          // ?create?watermark
          ????????Watermark?watermark? = ? new ?Watermark(watermarkImage,?Watermark.LAYOUT_TOP_LEFT,? 0.2f );

          ????????
          // ?apply?watermark
          ????????GifImage?topLeftWatermarked? = ?watermark.apply(gifImage,? true );
          ????????
          // ?apply?watermark?smoothly
          ????????GifImage?topLeftWatermarked_smoothly? = ?watermark.apply(gifImage,? true );

          ????????
          // ?change?the?watermark?alignment
          ????????watermark.setLayoutConstraint(Watermark.LAYOUT_MIDDLE_CENTER);

          ????????
          // ?apply?watermark
          ????????GifImage?middleCenterWatermarked? = ?watermark.apply(gifImage,? false );
          ????????
          // ?apply?watermark?smoothly
          ????????GifImage?middleCenterWatermarked_smoothly? = ?watermark.apply(gifImage,? true );

          ????????
          // ?change?the?watermark?alignment
          ????????watermark.setLayoutConstraint(Watermark.LAYOUT_BOTTOM_RIGHT);

          ????????
          // ?apply?watermark
          ????????GifImage?bottomRightWatermarked? = ?watermark.apply(gifImage,? false );
          ????????
          // ?apply?watermark?smoothly
          ????????GifImage?bottomRightWatermarked_smoothly? = ?watermark.apply(gifImage,? true );

          ????????
          // ?change?the?watermark?alignment
          ????????watermark.setLayoutConstraint(Watermark.LAYOUT_COVER_CONSECUTIVELY);
          ????????
          // ?change?the?watermark?transparency
          ????????watermark.setTransparency( 0.20f );

          ????????
          // ?apply?watermark
          ????????GifImage?coverConsWatermarked? = ?watermark.apply(gifImage,? false );
          ????????
          // ?apply?watermark?smoothly
          ????????GifImage?coverConsWatermarked_smoothly? = ?watermark.apply(gifImage,? true );

          ????????
          // ?Save?the?results
          ???????? try ?{
          ????????????GifEncoder.encode(topLeftWatermarked,
          new ?File(outputDir, " topLeftWatermarked.gif " ));
          ????????????GifEncoder.encode(topLeftWatermarked_smoothly,
          new ?File(outputDir, " topLeftWatermarked_smooth.gif " ));
          ????????????GifEncoder.encode(middleCenterWatermarked,
          new ?File(outputDir, " middleCenterWatermarked.gif " ));
          ????????????GifEncoder.encode(middleCenterWatermarked_smoothly,
          new ?File(outputDir, " middleCenterWatermarked_smooth.gif " ));
          ????????????GifEncoder.encode(bottomRightWatermarked,
          new ?File(outputDir, " bottomRightWatermarked.gif " ));
          ????????????GifEncoder.encode(bottomRightWatermarked_smoothly,
          new ?File(outputDir, " bottomRightWatermarked_smooth.gif " ));
          ????????????GifEncoder.encode(coverConsWatermarked,
          new ?File(outputDir, " coverConsWatermarked.gif " ));
          ????????????GifEncoder.encode(coverConsWatermarked_smoothly,
          new ?File(outputDir, " coverConsWatermarked_smooth.gif " ));
          ????????}?
          catch ?(IOException?e)?{
          ????????????e.printStackTrace();
          ????????}
          ????}
          }
          下面是運(yùn)行的結(jié)果:
          topLeftWatermarked.gifmiddleCenterWatermarked.gif
          coverConsWatermarked.gifbottomRightWatermarked_smooth.gif

          破解的包放在我的UserGroup下載:
          http://dev2dev.bea.com.cn/bbs/thread.jspa?forumID=29304&threadID=36395&messageID=214504

          posted on 2006-07-17 10:32 david.turing 閱讀(7070) 評(píng)論(6)  編輯  收藏 所屬分類: Java類庫收集 、數(shù)字水印

          評(píng)論

          # re: 發(fā)布GIF4J破解版 2006-07-17 11:00 靈感之源

          不錯(cuò)  回復(fù)  更多評(píng)論   

          # re: 發(fā)布GIF4J破解版 2006-11-15 10:09 jacky_hn

          老大。這個(gè)GIF怎么支持中文呀。我用watermarked 輸出中文的時(shí)候全是亂碼?。?!郁悶忘老大能解決。。  回復(fù)  更多評(píng)論   

          # re: 發(fā)布GIF4J破解版 2007-09-14 17:42 shengjie

          樓主破解的好像有bug
          公司最近用這個(gè)包的時(shí)候。把jpg文件改為gif之后上傳。tomcat自動(dòng)關(guān)閉了。
          我們?cè)跈z查錯(cuò)誤。不知道是gif4j的問題還是我們代碼的問題。
            回復(fù)  更多評(píng)論   

          # re: 發(fā)布GIF4J破解版 2007-09-16 12:57 david.turing

          哦,JPG似乎不支持吧?  回復(fù)  更多評(píng)論   

          # re: 發(fā)布GIF4J破解版 2008-02-28 09:16 xyflash

          如果要加圖片水印扎辦  回復(fù)  更多評(píng)論   

          # re: 發(fā)布GIF4J破解版 2008-12-14 09:49 jackyren007

          不錯(cuò)  回復(fù)  更多評(píng)論   


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。

          網(wǎng)站導(dǎo)航:
           

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿(110)

          我參與的團(tuán)隊(duì)

          隨筆分類(126)

          隨筆檔案(155)

          文章分類(9)

          文章檔案(19)

          相冊(cè)

          搜索

          積分與排名

          最新隨筆

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 汪清县| 咸阳市| 景泰县| 长武县| 甘泉县| 新郑市| 鄂温| 遂昌县| 西青区| 桑植县| 门源| 丰都县| 加查县| 环江| 缙云县| 东乡县| 饶河县| 邵武市| 措勤县| 衡阳市| 洪雅县| 曲阳县| 江西省| 洱源县| 松滋市| 东台市| 天津市| 余庆县| 双城市| 汉寿县| 共和县| 绥宁县| 仁布县| 杨浦区| 仁化县| 灵寿县| 九台市| 阳东县| 新乡市| 云安县| 昌乐县|