|
|
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[WM]: Documentation of code
Hi watermarks
Can anyone help me. I need to know what this program exactly does? Thanks in advance
public class WaterTest
{
public static void processFile(String fileName, String sWatermark, = String
formatTag)
{
WaterImage wi = new WaterImage(); // new object
String wMessage = null; // used for recheck the watermark
wi.loadFromFile(fileName); // load the image from the disk
if (wi.getImage()!=null) // if we did
load an image
{
// show some info about the image
System.out.println("Image: " + fileName +" size: " +
wi.getImage().getWidth() + "x" +
wi.getImage().getHeight() + " bbp: " +
wi.getImage().getColorModel().getPixelSize());
wi.markImage(sWatermark.getBytes()); // make the watermark
wi.saveToFile(fileName + ".LSB." + formatTag, formatTag);
// reread the watermark to check
wMessage = new String(wi.readWatermark());
if (wMessage!=null) // if we did read something
if (wMessage.length()>0) // not empty string
System.out.println("Watermark info: " +wMessage); // print = the watermark string
}
}
public static void main(String[] args)
{
long time; // used to see the speed of processing
String sWatermark = "watermark string sample"; // a string as watermark to test our class
for (int i = 0; i < args.length; i++) // for each argument
{
System.out.println("Processing file " + args[i]);
time = System.currentTimeMillis();
processFile(args[i], sWatermark, "png"); // process the file
System.out.println(" ... watermarked and saved in " +
((System.currentTimeMillis() - time) / 1000) + " = second(s)"); // done
}
}
}
______________________________________________________________________________
Watermarking Mailing List - http://www.watermarkingworld.org/ml.html
To unsubscribe send email to "majordomo@watermarkingworld.org" with
"unsubscribe watermarking YOURMAIL" in the body.
______________________________________________________________________________
|