humble-video-noarch/src/main/java/io/humble/video/awt/MediaPictureConverterFactory.java
public static BufferedImage convertToType(BufferedImage sourceImage, 
    int targetType)
  {
    BufferedImage image;

    // if the source image is already the target type, return the source image

    if (sourceImage.getType() == targetType)
      image = sourceImage;

    // otherwise create a new image of the target type and draw the new
    // image 

    else
    {
      image = new BufferedImage(sourceImage.getWidth(), sourceImage.getHeight(),
        targetType);
      image.getGraphics().drawImage(sourceImage, 0, 0, null);
    }
    
    return image;
  }
public static BufferedImage convertToType(BufferedImage sourceImage, 
    int targetType)
  {
    BufferedImage image;

    // if the source image is already the target type, return the source image

    if (sourceImage.getType() == targetType)
      image = sourceImage;

    // otherwise create a new image of the target type and draw the new
    // image 

    else
    {
      image = new BufferedImage(sourceImage.getWidth(), sourceImage.getHeight(),
        targetType);
      image.getGraphics().drawImage(sourceImage, 0, 0, null);
    }
    
    return image;
  }
public static BufferedImage convertToType ( BufferedImage sourceImage , int targetType ) { BufferedImage image ; // if the source image is already the target type, return the source image if ( sourceImage . getType ( ) == targetType ) image = sourceImage ; // otherwise create a new image of the target type and draw the new // image  else { image = new BufferedImage ( sourceImage . getWidth ( ) , sourceImage . getHeight ( ) , targetType ) ; image . getGraphics ( ) . drawImage ( sourceImage , 0 , 0 , null ) ; } return image ; }
Convert a {@link BufferedImage} of any type, to {@link
BufferedImage} of a specified type.  If the source image is the
same type as the target type, then original image is returned,
otherwise new image of the correct type is created and the content
of the source image is copied into the new image.

@param sourceImage the image to be converted
@param targetType the desired BufferedImage type

@return a BufferedImage of the specifed target type.

@see BufferedImage
Convert a { @link BufferedImage } of any type to { @link BufferedImage } of a specified type . If the source image is the same type as the target type then original image is returned otherwise new image of the correct type is created and the content of the source image is copied into the new image .