利用 Java 將圖像轉換成負片效果 (Use Java to edit an image to negative)

import java.awt.image.BufferedImage;import java.awt.Graphics2D;

public static BufferedImage negative(BufferedImage source){    BufferedImage out = new BufferedImage(source.getWidth(), source.getHeight(), source.getType());    for (int i = 0; i < out.getWidth(); i++) {        for (int j = 0; j < out.getHeight(); j++) {            out.setRGB(i, j,
apple.jpg
Continue reading...

利用 Java 改變圖像畫布的闊及高 (Use Java to edit the canvas of an image)

import java.awt.image.BufferedImage;import java.awt.Graphics2D;import java.awt.Color;

public static BufferedImage canvas(BufferedImage source, int width, int height, int x, int y, int cx, int cy, Color color){    BufferedImage out = new BufferedImage(width, height, source.getType());    Graphics2D g2d = out.createGraphics();    g2d.setColor(color);    g2d.fillRect(
apple.jpg
Continue reading...

利用 Java 為圖像添加邊緣(Use Java to trim an image )

import java.awt.image.BufferedImage;import java.awt.Graphics2D;import java.awt.Color;

public static BufferedImage trim(BufferedImage source, int topMargin, int bottomMargin, int leftMargin, int rightMargin, Color color){    int width = source.getWidth() + leftMargin + rightMargin;    int height = source.getHeight() + topMargin + bottomMargin;    BufferedImage out = new BufferedImage(width, height, source.getType());    Graphics2D g2d = out
apple.jpg
Continue reading...

利用 Java 過濾圖像的色彩頻道 (Use Java to filter the color channel of an image)

import java.awt.image.BufferedImage;import java.awt.Color;

public static BufferedImage getColorChannel(BufferedImage source, Color color){    BufferedImage out = new BufferedImage(source.getWidth(), source.getHeight(), source.getType());    for (int i = 0; i < out.getHeight(); i++) {        for (int j = 0; j < out.getWidth(); j++) {            out.setRGB(i, j
apple.jpg
Continue reading...

利用 Java 將圖像轉換成灰度圖像 (Use Java to edit an image to grayscale)

import java.awt.image.BufferedImage;import java.awt.Graphics2D;

public static BufferedImage grayscale(BufferedImage source){    BufferedImage out = new BufferedImage(source.getWidth(), source.getHeight(), BufferedImage.TYPE_BYTE_GRAY);    Graphics2D g2d = out.createGraphics();    g2d.drawImage(source, 0, 0, null);    g2d.dispose();    return out;}

修改前
before
apple.jpg

修改
Continue reading...

在 Java 正確複製 BufferedImage 的圖像資料 (Correct way to copy BufferedImage data from Java)

import java.awt.image.BufferedImage

public static BufferedImage copy(BufferedImage source){    return (BufferedImage)source.clone();}BufferedImage img1 = source;BufferedImage img2 = copy(source);

以上兩種是有分別的
img1 會得到與 source 相同的 hash code, 所以兩者是完全相同的, 當 img1 被修改 source 同樣會被修改
img2 則是將 source 的每一個 pixel

利用 Java 剪裁圖像的指定範圍 (Use Java to cut a rectangle of area from an image)

import java.awt.image.BufferedImage;import java.awt.Graphics2D;import java.awt.Color;

public static BufferedImage cut(BufferedImage source, int x, int y, int width, int height, int cx, int cy, Color color){    BufferedImage out = new BufferedImage(width, height, source.getType());    Graphics2D g2d = out.createGraphics();    g2d.setColor(color);    g2d.fillRect(
apple.jpg
Continue reading...

利用 Java 改變圖像的闊及高 (Use Java to edit an image width and height)

import java.awt.image.BufferedImage;import java.awt.Graphics2D;

public static BufferedImage resize(BufferedImage source, int width, int height){    BufferedImage out = new BufferedImage(width, height, source.getType());    Graphics2D g2d = out.createGraphics();    g2d.drawImage(source, 0, 0, width, height, null);    g2d.dispose();    return out;}

修改前
before
apple.jpg

以 resize
Continue reading...

善用 Windows Live 的 SkyDrive

Microsoft 為 Windows Live 用戶提供一個共 25GB 的網絡硬碟
並擁有分享、共用等功能讓用戶及各網絡使用者存取檔案
設定不同的存取等級可以讓非 Windows Live 用戶亦擁有存取權限

使用方面非常簡單
只要用戶擁有 Windows Live 帳戶, 並到 https://skydrive.live.com/

於 Ubuntu 安裝 Google Chrome (Install Google Chrome in Ubuntu)

前往 https://www.google.com/chrome/
Visit https://www.google.com/chrome/

選擇語言後按 >下載Google瀏覽器>
(Google Chrome 在 2010-03-30 前仍是 Beta 版本)
After select the language then click >Download Google Chrome>
(Google Chrome is the latest version on 2010-03-30 which is a Beta version)

選擇版