Here you can find the source of prepareModel(BufferedImage model)
Parameter | Description |
---|---|
model | a parameter |
private static BufferedImage prepareModel(BufferedImage model)
//package com.java2s; //License from project: Apache License import java.awt.image.BufferedImage; public class Main { /**// w ww.ja v a 2 s . c o m * Converts the supplied {@link BufferedImage} to a format that is appropriate to use as * a model for an output image. In general, this means cropping the image to ensure that * only minimal image data is stored in the configuration for a * <p> * One of the easiest ways to construct an image is to use an existing image as the template * to determine the correct number bands, data packing strategies, color model, etc. This * method is useful to convert an existing image that will serve as a * * @param model * @return */ private static BufferedImage prepareModel(BufferedImage model) { // HACK using a buffered image as a model is a hack for reconstructing a new buffered image. // should improve the toImage method on BinaryImage if (model.getWidth() > 2 || model.getHeight() > 2) { // TODO trim to minimal image return model.getSubimage(0, 0, 2, 2); // discard image data } return model; } }