Package org.fluxtream.core.images

Examples of org.fluxtream.core.images.Image


        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);
    }

    private void testCreateThumbnailHelper(@NotNull final byte[] imageBytes, final int lengthOfLongestSideInPixels, @NotNull final Dimension expectedDimension) throws IOException {
        final Image thumbnail = ImageUtils.createJpegThumbnail(imageBytes, lengthOfLongestSideInPixels);
        Assert.assertNotNull(thumbnail);
        Assert.assertEquals(expectedDimension, new Dimension(thumbnail.getWidth(), thumbnail.getHeight()));
    }
View Full Code Here


        this.photoHash = HashUtils.computeSha256Hash(photoBytes);
        photoStoreKey = createPhotoStoreKey(guestId, captureYYYYDDD, captureTimeMillisUtc, photoHash);

        // Create the thumbnails: do so by creating the largest one first, and then creating the smaller
        // ones from the larger--this should be faster than creating each from the original image
        final Image thumbnail2Image = ImageUtils.createJpegThumbnail(photoBytes, THUMBNAIL_2_MAX_SIDE_LENGTH_IN_PIXELS);
        if (thumbnail2Image == null) {
            throw new IOException("Failed to create thumbnails");
        }

        final Image thumbnail1Image = ImageUtils.createJpegThumbnail(thumbnail2Image.getBytes(), THUMBNAIL_1_MAX_SIDE_LENGTH_IN_PIXELS);
        if (thumbnail1Image == null) {
            throw new IOException("Failed to create thumbnails");
        }

        final Image thumbnail0Image = ImageUtils.createJpegThumbnail(thumbnail1Image.getBytes(), THUMBNAIL_0_MAX_SIDE_LENGTH_IN_PIXELS);
        if (thumbnail0Image == null) {
            throw new IOException("Failed to create thumbnails");
        }

        thumbnail0 = thumbnail0Image.getBytes();
        thumbnail1 = thumbnail1Image.getBytes();
        thumbnail2 = thumbnail2Image.getBytes();

        thumbnail0Size = new Dimension(thumbnail0Image.getWidth(), thumbnail0Image.getHeight());
        thumbnail1Size = new Dimension(thumbnail1Image.getWidth(), thumbnail1Image.getHeight());
        thumbnail2Size = new Dimension(thumbnail2Image.getWidth(), thumbnail2Image.getHeight());

        // get the image orientation, and default to ORIENTATION_1 if unspecified
        ImageOrientation orientationTemp;
View Full Code Here

TOP

Related Classes of org.fluxtream.core.images.Image

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.