Java BufferedImage Operation checkImageType(BufferedImage img, String name)

Here you can find the source of checkImageType(BufferedImage img, String name)

Description

Check image type.

License

Open Source License

Parameter

Parameter Description
img a parameter
name a parameter

Exception

Parameter Description
IllegalArgumentException when image type is invalid

Declaration

public static void checkImageType(BufferedImage img, String name) throws IllegalArgumentException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.image.BufferedImage;

public class Main {
    public static final int IMAGE_TYPE = BufferedImage.TYPE_INT_ARGB;
    private static final boolean CHECK_TYPE = false;

    /**//from w w w. ja v a  2  s  .  c o m
     * Check image type.
     *
     * @param img
     * @param name
     * @throws IllegalArgumentException when image type is invalid
     */
    public static void checkImageType(BufferedImage img, String name) throws IllegalArgumentException {
        if (CHECK_TYPE && img.getType() != IMAGE_TYPE) {
            throw new IllegalArgumentException(
                    String.format("Invalid %s.type=%s, expected %s", name, img.getType(), IMAGE_TYPE));
        }
    }
}

Related

  1. cascadeHorizontal(final BufferedImage... images)
  2. changeContrast(BufferedImage img, float amount)
  3. changeImageToArray(BufferedImage bufferedImage)
  4. checkIfManyColors(BufferedImage image)
  5. checkImageMatch(BufferedImage img1, String imgName1, BufferedImage img2, String imgName2)
  6. checkRadius(final BufferedImage src, final int x, final int y, final int opaqueLimit, final int radius)
  7. chunk(BufferedImage image)
  8. circularize(BufferedImage image)
  9. cleanBinaryImage(BufferedImage image)