Sectors: Finance • Information Technoloy • Government • Healthcare • Industries • Education • (show all)
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
import com.asprise.util.jtwain.*;
...
try {
Source source = SourceManager.instance().getDefaultSource(); // Acquire image from default source
source.open();
Image image = source.acquireImage(); // Acquire the image
// Loads the image completely ...
// Click here to find how to load images completely with MediaTracker.
// ...
int imageWidth = image.getWidth(this);
int imageHeight = image.getHeight(this);
BufferedImage bufferedImage = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = bufferedImage.createGraphics();
g2.drawImage(image, 0, 0, this);
// Now, you can use the bufferedImage object ...
}catch(Exception e) {
e.printStackTrace();
}finally{
SourceManager.closeSourceManager();
}