test_class.declarator: IMAGE_1 = readFileAsBytes("/images/test_image1.jpg")
test_class.modifier: private static final
test_class.original_string: private static final byte[] IMAGE_1 = readFileAsBytes("/images/test_image1.jpg");
test_class.type: byte[]
test_class.var_name: IMAGE_1
test_class.declarator: IMAGE_2 = readFileAsBytes("/images/test_image2.jpg")
test_class.modifier: private static final
test_class.original_string: private static final byte[] IMAGE_2 = readFileAsBytes("/images/test_image2.jpg");
test_class.type: byte[]
test_class.var_name: IMAGE_2
test_class.declarator: IMAGE_3 = readFileAsBytes("/images/test_image3.png")
test_class.modifier: private static final
test_class.original_string: private static final byte[] IMAGE_3 = readFileAsBytes("/images/test_image3.png");
test_class.type: byte[]
test_class.var_name: IMAGE_3
test_class.declarator: IMAGE_4 = readFileAsBytes("/images/test_image4.gif")
test_class.modifier: private static final
test_class.original_string: private static final byte[] IMAGE_4 = readFileAsBytes("/images/test_image4.gif");
test_class.type: byte[]
test_class.var_name: IMAGE_4
test_class.declarator: IMAGE_5 = readFileAsBytes("/images/test_image5.tiff")
test_class.modifier: private static final
test_class.original_string: private static final byte[] IMAGE_5 = readFileAsBytes("/images/test_image5.tiff");
test_class.type: byte[]
test_class.var_name: IMAGE_5
test_class.declarator: IMAGE_6 = readFileAsBytes("/images/test_image6.jpg")
test_class.modifier: private static final
test_class.original_string: private static final byte[] IMAGE_6 = readFileAsBytes("/images/test_image6.jpg");
test_class.type: byte[]
test_class.var_name: IMAGE_6
test_class.declarator: NOT_AN_IMAGE = "This is not an image".getBytes()
test_class.modifier: private static final
test_class.original_string: private static final byte[] NOT_AN_IMAGE = "This is not an image".getBytes();
test_class.type: byte[]
test_class.var_name: NOT_AN_IMAGE
test_class.declarator: IMAGE_1_EXPECTED_SIZE = new Dimension(265, 284)
test_class.modifier: private static final
test_class.original_string: private static final Dimension IMAGE_1_EXPECTED_SIZE = new Dimension(265, 284);
test_class.type: Dimension
test_class.var_name: IMAGE_1_EXPECTED_SIZE
test_class.declarator: IMAGE_2_EXPECTED_SIZE = new Dimension(2448, 3264)
test_class.modifier: private static final
test_class.original_string: private static final Dimension IMAGE_2_EXPECTED_SIZE = new Dimension(2448, 3264);
test_class.type: Dimension
test_class.var_name: IMAGE_2_EXPECTED_SIZE
test_class.declarator: IMAGE_3_EXPECTED_SIZE = new Dimension(1024, 1365)
test_class.modifier: private static final
test_class.original_string: private static final Dimension IMAGE_3_EXPECTED_SIZE = new Dimension(1024, 1365);
test_class.type: Dimension
test_class.var_name: IMAGE_3_EXPECTED_SIZE
test_class.declarator: IMAGE_4_EXPECTED_SIZE = new Dimension(265, 284)
test_class.modifier: private static final
test_class.original_string: private static final Dimension IMAGE_4_EXPECTED_SIZE = new Dimension(265, 284);
test_class.type: Dimension
test_class.var_name: IMAGE_4_EXPECTED_SIZE
test_class.declarator: IMAGE_6_EXPECTED_SIZE = new Dimension(776, 909)
test_class.modifier: private static final
test_class.original_string: private static final Dimension IMAGE_6_EXPECTED_SIZE = new Dimension(776, 909);
test_class.type: Dimension
test_class.var_name: IMAGE_6_EXPECTED_SIZE
test_class.file: fluxtream-core/src/test/java/org/fluxtream/core/utils/ImageUtilsTest.java
test_class.identifier: ImageUtilsTest
test_case.body: @Test
      public void testCreateThumbnail() throws Exception {
          Assert.assertNull(ImageUtils.createJpegThumbnail(null, -1));
          Assert.assertNull(ImageUtils.createJpegThumbnail(null, 0));
          Assert.assertNull(ImageUtils.createJpegThumbnail(null, 100));
          Assert.assertNull(ImageUtils.createJpegThumbnail(new byte[]{}, -1));
          Assert.assertNull(ImageUtils.createJpegThumbnail(new byte[]{}, 0));
          Assert.assertNull(ImageUtils.createJpegThumbnail(new byte[]{}, 100));
          Assert.assertNull(ImageUtils.createJpegThumbnail(IMAGE_1, -1));
          Assert.assertNull(ImageUtils.createJpegThumbnail(IMAGE_1, 0));
          Assert.assertNull(ImageUtils.createJpegThumbnail(NOT_AN_IMAGE, 100));
  
          testCreateThumbnailHelper(IMAGE_1, 50, new Dimension(47, 50));
          testCreateThumbnailHelper(IMAGE_1, 100, new Dimension(93, 100));
          testCreateThumbnailHelper(IMAGE_1, (int)Math.max(IMAGE_1_EXPECTED_SIZE.getHeight(), IMAGE_1_EXPECTED_SIZE.getWidth()), IMAGE_1_EXPECTED_SIZE);
  
          testCreateThumbnailHelper(IMAGE_2, 50, new Dimension(38, 50));
          testCreateThumbnailHelper(IMAGE_2, 100, new Dimension(75, 100));
          testCreateThumbnailHelper(IMAGE_2, (int)Math.max(IMAGE_2_EXPECTED_SIZE.getHeight(), IMAGE_2_EXPECTED_SIZE.getWidth()), IMAGE_2_EXPECTED_SIZE);
  
          testCreateThumbnailHelper(IMAGE_3, 50, new Dimension(38, 50));
          testCreateThumbnailHelper(IMAGE_3, 100, new Dimension(75, 100));
          testCreateThumbnailHelper(IMAGE_3, (int)Math.max(IMAGE_3_EXPECTED_SIZE.getHeight(), IMAGE_3_EXPECTED_SIZE.getWidth()), IMAGE_3_EXPECTED_SIZE);
  
          testCreateThumbnailHelper(IMAGE_4, 50, new Dimension(47, 50));
          testCreateThumbnailHelper(IMAGE_4, 100, new Dimension(93, 100));
          testCreateThumbnailHelper(IMAGE_4, (int)Math.max(IMAGE_4_EXPECTED_SIZE.getHeight(), IMAGE_4_EXPECTED_SIZE.getWidth()), IMAGE_4_EXPECTED_SIZE);
  
          testCreateThumbnailHelper(IMAGE_6, 50, new Dimension(43, 50));
          testCreateThumbnailHelper(IMAGE_6, 100, new Dimension(85, 100));
          testCreateThumbnailHelper(IMAGE_6, (int)Math.max(IMAGE_6_EXPECTED_SIZE.getHeight(), IMAGE_6_EXPECTED_SIZE.getWidth()), IMAGE_6_EXPECTED_SIZE);
      }
test_case.class_method_signature: ImageUtilsTest.testCreateThumbnail()
test_case.full_signature: @Test public void testCreateThumbnail()
test_case.identifier: testCreateThumbnail
test_case.invocations: assertNull createJpegThumbnail assertNull createJpegThumbnail assertNull createJpegThumbnail assertNull createJpegThumbnail assertNull createJpegThumbnail assertNull createJpegThumbnail assertNull createJpegThumbnail assertNull createJpegThumbnail assertNull createJpegThumbnail testCreateThumbnailHelper testCreateThumbnailHelper testCreateThumbnailHelper max getHeight getWidth testCreateThumbnailHelper testCreateThumbnailHelper testCreateThumbnailHelper max getHeight getWidth testCreateThumbnailHelper testCreateThumbnailHelper testCreateThumbnailHelper max getHeight getWidth testCreateThumbnailHelper testCreateThumbnailHelper testCreateThumbnailHelper max getHeight getWidth testCreateThumbnailHelper testCreateThumbnailHelper testCreateThumbnailHelper max getHeight getWidth
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCreateThumbnail()
focal_class.declarator: LOG = FlxLogger.getLogger(ImageUtils.class)
focal_class.modifier: private static final
focal_class.original_string: private static final FlxLogger LOG = FlxLogger.getLogger(ImageUtils.class);
focal_class.type: FlxLogger
focal_class.var_name: LOG
focal_class.file: fluxtream-core/src/main/java/org/fluxtream/core/utils/ImageUtils.java
focal_class.identifier: ImageUtils
focal_class.class_method_signature: ImageUtils.isSupportedImage(@Nullable final byte[] imageBytes)
focal_class.full_signature: public static boolean isSupportedImage(@Nullable final byte[] imageBytes)
focal_class.identifier: isSupportedImage
focal_class.modifiers: public static
focal_class.parameters: (@Nullable final byte[] imageBytes)
focal_class.return: boolean
focal_class.signature: boolean isSupportedImage(@Nullable final byte[] imageBytes)
focal_class.class_method_signature: ImageUtils.createJpegThumbnail(@Nullable final byte[] imageBytes, final int lengthOfLongestSideInPixels)
focal_class.full_signature: @Nullable public static Image createJpegThumbnail(@Nullable final byte[] imageBytes, final int lengthOfLongestSideInPixels)
focal_class.identifier: createJpegThumbnail
focal_class.modifiers: @Nullable public static
focal_class.parameters: (@Nullable final byte[] imageBytes, final int lengthOfLongestSideInPixels)
focal_class.return: Image
focal_class.signature: Image createJpegThumbnail(@Nullable final byte[] imageBytes, final int lengthOfLongestSideInPixels)
focal_class.class_method_signature: ImageUtils.dropAlphaChannel(@NotNull final BufferedImage srcImage)
focal_class.full_signature: @NotNull private static BufferedImage dropAlphaChannel(@NotNull final BufferedImage srcImage)
focal_class.identifier: dropAlphaChannel
focal_class.modifiers: @NotNull private static
focal_class.parameters: (@NotNull final BufferedImage srcImage)
focal_class.return: BufferedImage
focal_class.signature: BufferedImage dropAlphaChannel(@NotNull final BufferedImage srcImage)
focal_class.class_method_signature: ImageUtils.getGeolocation(@Nullable final byte[] imageBytes)
focal_class.full_signature: @Nullable public static Geolocation getGeolocation(@Nullable final byte[] imageBytes)
focal_class.identifier: getGeolocation
focal_class.modifiers: @Nullable public static
focal_class.parameters: (@Nullable final byte[] imageBytes)
focal_class.return: Geolocation
focal_class.signature: Geolocation getGeolocation(@Nullable final byte[] imageBytes)
focal_class.class_method_signature: ImageUtils.getOrientation(@Nullable final byte[] imageBytes)
focal_class.full_signature: @Nullable public static ImageOrientation getOrientation(@Nullable final byte[] imageBytes)
focal_class.identifier: getOrientation
focal_class.modifiers: @Nullable public static
focal_class.parameters: (@Nullable final byte[] imageBytes)
focal_class.return: ImageOrientation
focal_class.signature: ImageOrientation getOrientation(@Nullable final byte[] imageBytes)
focal_class.class_method_signature: ImageUtils.convertToBufferedImage(@Nullable final byte[] imageBytes)
focal_class.full_signature: @Nullable public static BufferedImage convertToBufferedImage(@Nullable final byte[] imageBytes)
focal_class.identifier: convertToBufferedImage
focal_class.modifiers: @Nullable public static
focal_class.parameters: (@Nullable final byte[] imageBytes)
focal_class.return: BufferedImage
focal_class.signature: BufferedImage convertToBufferedImage(@Nullable final byte[] imageBytes)
focal_class.class_method_signature: ImageUtils.convertToJpegByteArray(@Nullable final BufferedImage image)
focal_class.full_signature: @Nullable public static byte[] convertToJpegByteArray(@Nullable final BufferedImage image)
focal_class.identifier: convertToJpegByteArray
focal_class.modifiers: @Nullable public static
focal_class.parameters: (@Nullable final BufferedImage image)
focal_class.return: byte[]
focal_class.signature: byte[] convertToJpegByteArray(@Nullable final BufferedImage image)
focal_class.class_method_signature: ImageUtils.getImageType(@Nullable final byte[] imageBytes)
focal_class.full_signature: @Nullable public static ImageType getImageType(@Nullable final byte[] imageBytes)
focal_class.identifier: getImageType
focal_class.modifiers: @Nullable public static
focal_class.parameters: (@Nullable final byte[] imageBytes)
focal_class.return: ImageType
focal_class.signature: ImageType getImageType(@Nullable final byte[] imageBytes)
focal_class.class_method_signature: ImageUtils.ImageUtils()
focal_class.full_signature: private  ImageUtils()
focal_class.identifier: ImageUtils
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  ImageUtils()
focal_method.body: @Nullable
      public static Image createJpegThumbnail(@Nullable final byte[] imageBytes, final int lengthOfLongestSideInPixels) throws IOException {
          if (imageBytes != null && imageBytes.length > 0 && lengthOfLongestSideInPixels > 0) {
  
              ImageOrientation orientation = ImageOrientation.getOrientation(new ByteArrayInputStream(imageBytes));
              if (orientation == null) {
                  orientation = ImageOrientation.ORIENTATION_1;
              }
  
              try {
                  BufferedImage image = convertToBufferedImage(imageBytes);
                  if (image != null) {
                      // drop the alpha channel, if one exists
                      if (image.getColorModel().hasAlpha()) {
                          image = dropAlphaChannel(image);
                      }
                      return JpegImage.create(orientation.transform(Scalr.resize(image, Scalr.Method.AUTOMATIC, Scalr.Mode.AUTOMATIC, lengthOfLongestSideInPixels)));
                  }
              }
              catch (Exception e) {
                  final String message = "Exception while trying to create a thumbnail";
                  LOG.error(message, e);
                  throw new IOException(e);
              }
          }
  
          return null;
      }
focal_method.class_method_signature: ImageUtils.createJpegThumbnail(@Nullable final byte[] imageBytes, final int lengthOfLongestSideInPixels)
focal_method.full_signature: @Nullable public static Image createJpegThumbnail(@Nullable final byte[] imageBytes, final int lengthOfLongestSideInPixels)
focal_method.identifier: createJpegThumbnail
focal_method.invocations: getOrientation convertToBufferedImage hasAlpha getColorModel dropAlphaChannel create transform resize error
focal_method.modifiers: @Nullable public static
focal_method.parameters: (@Nullable final byte[] imageBytes, final int lengthOfLongestSideInPixels)
focal_method.return: Image
focal_method.signature: Image createJpegThumbnail(@Nullable final byte[] imageBytes, final int lengthOfLongestSideInPixels)