Class ImageUtils

java.lang.Object
com.mortennobel.imagescaling.ImageUtils

public class ImageUtils extends Object
  • Constructor Details

    • ImageUtils

      public ImageUtils()
  • Method Details

    • imageTypeName

      public static String imageTypeName(BufferedImage img)
    • nrChannels

      public static int nrChannels(BufferedImage img)
    • getPixelsBGR

      public static byte[] getPixelsBGR(BufferedImage img, int y, int w, byte[] array, int[] temp)
      returns one row (height == 1) of byte packed image data in BGR or AGBR form
      Parameters:
      img -
      y -
      w -
      array -
      temp - must be either null or a array with length of w*h
      Returns:
    • setBGRPixels

      public static void setBGRPixels(byte[] bgrPixels, BufferedImage img, int x, int y, int w, int h)
      converts and copies byte packed BGR or ABGR into the img buffer, the img type may vary (e.g. RGB or BGR, int or byte packed) but the number of components (w/o alpha, w alpha, gray) must match does not unmange the image for all (A)RGN and (A)BGR and gray imaged
    • ints2bytes

      public static void ints2bytes(int[] in, byte[] out, int index1, int index2, int index3)
    • ints2bytes

      public static void ints2bytes(int[] in, byte[] out, int index1, int index2, int index3, int index4)
    • bytes2int

      public static int[] bytes2int(byte[] in, int index1, int index2, int index3)
    • bytes2int

      public static int[] bytes2int(byte[] in, int index1, int index2, int index3, int index4)
    • convert

      public static BufferedImage convert(BufferedImage src, int bufImgType)
    • copyJpegMetaData

      public static byte[] copyJpegMetaData(byte[] source, byte[] dest) throws IOException
      Copy jpeg meta data (exif) from source to dest and save it to out.
      Parameters:
      source -
      dest -
      Returns:
      result
      Throws:
      IOException
    • copyJpegMetaData

      public static void copyJpegMetaData(InputStream source, InputStream dest, ImageOutputStream out) throws IOException
      Copy jpeg meta data (exif) from source to dest and save it to out
      Parameters:
      source -
      dest -
      out -
      Throws:
      IOException