com.google.appengine.api.images.ImagesServiceFactory Java Examples

The following examples show how to use com.google.appengine.api.images.ImagesServiceFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: wmf2svg   Author: hidekatsu-izuno   File: ImageUtil.java    License: Apache License 2.0 6 votes vote down vote up
public byte[] convert(byte[] image, String destType, boolean reverse) {
	if (destType == null) {
		throw new IllegalArgumentException("dest type is null.");
	} else {
		destType = destType.toLowerCase();
	}

	ImagesService.OutputEncoding encoding = null;
	if ("png".equals(destType)) {
		encoding = OutputEncoding.PNG;
	} else if ("jpeg".equals(destType)) {
		encoding = OutputEncoding.JPEG;
	} else {
		throw new UnsupportedOperationException("unsupported image encoding: " + destType);
	}

	ImagesService imagesService = ImagesServiceFactory.getImagesService();
	Image bmp = ImagesServiceFactory.makeImage(image);

	Transform t = (reverse) ? ImagesServiceFactory.makeVerticalFlip() : ImagesServiceFactory.makeCompositeTransform();
	return imagesService.applyTransform(t, bmp, encoding).getImageData();
}
 
Example #2
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: TransformationsTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testResizeAsync() throws IOException {
    InputSettings inputSettings = new InputSettings();
    OutputSettings outputSettings = new OutputSettings(OutputEncoding.PNG);

    Image originalImage = readImage(CAPEDWARF_PNG);
    Image resizedImage = waitOnFuture(imagesService.applyTransformAsync(ImagesServiceFactory.makeResize(400, 286), originalImage));
    assertEquals(400, resizedImage.getWidth());
    assertEquals(286, resizedImage.getHeight());

    originalImage = readImage(CAPEDWARF_PNG);
    resizedImage = waitOnFuture(imagesService.applyTransformAsync(ImagesServiceFactory.makeResize(300, 286), originalImage, outputSettings));
    assertEquals(300, resizedImage.getWidth());
    assertEquals(215, resizedImage.getHeight());

    originalImage = readImage(CAPEDWARF_PNG);
    resizedImage = waitOnFuture(imagesService.applyTransformAsync(ImagesServiceFactory.makeResize(300, 286), originalImage, inputSettings, outputSettings));
    assertEquals(300, resizedImage.getWidth());
    assertEquals(215, resizedImage.getHeight());

    originalImage = readImage(CAPEDWARF_PNG);
    resizedImage = waitOnFuture(imagesService.applyTransformAsync(ImagesServiceFactory.makeResize(300, 286), originalImage, OutputEncoding.JPEG));
    assertEquals(300, resizedImage.getWidth());
    assertEquals(215, resizedImage.getHeight());
}
 
Example #3
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: TransformationsTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testResizeWithCrop() throws IOException {
    int resizedWidth = 300;
    int resizedHeight = 200;
    Image originalImage = readImage(CAPEDWARF_PNG);
    Transform resize = ImagesServiceFactory.makeResize(resizedWidth, resizedHeight, 0.5f, 0.5f);
    Image resizedImage = imagesService.applyTransform(resize, originalImage);
    assertEquals(resizedWidth, resizedImage.getWidth());
    assertEquals(resizedHeight, resizedImage.getHeight());

    originalImage = readImage(CAPEDWARF_PNG);
    resize = ImagesServiceFactory.makeResize(resizedWidth, resizedHeight, 0.5, 0.5);
    resizedImage = imagesService.applyTransform(resize, originalImage);
    assertEquals(resizedWidth, resizedImage.getWidth());
    assertEquals(resizedHeight, resizedImage.getHeight());
}
 
Example #4
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: ImagesServiceTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testRotate() throws IOException {
    ChkType chkType;
    for (int dg : DEGREES) {
        Transform transform = ImagesServiceFactory.makeRotate(dg);
        if ((dg == 90) || (dg == 270)) {
            chkType = ChkType.ROTATE;
        } else {
            chkType = ChkType.FLIP;
        }
        for (String sfile : FNAMES) {
            for (OutputEncoding encoding : ENCODES) {
                applyAndVerify(sfile, transform, chkType, encoding);
            }
        }
    }
}
 
Example #5
Source Project: appinventor-extensions   Author: mit-cml   File: GalleryServiceImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * It will return a dev server serving url for given image url
 * @param url image url
 */
@Override
public String getBlobServingUrl(String url) {
  BlobKey bk = BlobstoreServiceFactory.getBlobstoreService().createGsBlobKey(url);
  String u = null;
  try {
      u = ImagesServiceFactory.getImagesService().getServingUrl(bk);
  } catch (Exception IllegalArgumentException) {
      LOG.info("Could not read blob");
  }
  return u;
}
 
Example #6
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: IntegrationTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testHorizontalFlip() throws IOException {
    Image image = readImage("capedwarf.png");
    Transform horizontalFlip = ImagesServiceFactory.makeHorizontalFlip();

    Image flippedImage = imagesService.applyTransform(horizontalFlip, image);

    assertNotNull(flippedImage);
}
 
Example #7
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: TifImageTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testResize() throws IOException {
    assumeEnvironment(Environment.APPSPOT, Environment.CAPEDWARF);
    int resizeWidth = 150;
    int resizeHeigh = 150;
    Transform transform = ImagesServiceFactory.makeResize(resizeWidth, resizeHeigh);
    assertTransformation(transform, "Resize");
}
 
Example #8
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: TifImageTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testRotate() throws IOException {
    assumeEnvironment(Environment.APPSPOT, Environment.CAPEDWARF);
    int rotageDegree = 90;
    Transform transform = ImagesServiceFactory.makeRotate(rotageDegree);
    assertTransformation(transform, "Rotate");
}
 
Example #9
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: TifImageTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testCrop() throws IOException {
    assumeEnvironment(Environment.APPSPOT, Environment.CAPEDWARF);
    double cropLeftX = 0.0;
    double cropTopY = 0.0;
    double cropRightX = 0.5;
    double cropBottomY = 0.5;
    Transform transform = ImagesServiceFactory.makeCrop(
        cropLeftX,
        cropTopY,
        cropRightX,
        cropBottomY
    );
    assertTransformation(transform, "Crop");
}
 
Example #10
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: CompositeTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testDefault() throws IOException {
    // w - 200, h - 143
    Image originalImage = readImage(CAPEDWARF_PNG);
    Composite c1 = ImagesServiceFactory.makeComposite(originalImage, 0, 0, 1, Composite.Anchor.BOTTOM_LEFT);
    Image ci = imagesService.composite(newArrayList(c1), 200, 143, 0);
    assertImages(null, originalImage, ci);

}
 
Example #11
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: CompositeTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testEncoding() throws IOException {
    Image originalImage = readImage(CAPEDWARF_PNG);
    Composite c1 = ImagesServiceFactory.makeComposite(originalImage, 0, 0, 1, Composite.Anchor.BOTTOM_LEFT);
    Image ci = imagesService.composite(newArrayList(c1), 200, 143, 0, OutputEncoding.JPEG);
    assertImages(null, originalImage, ci);
}
 
Example #12
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: CompositeTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testSettings() throws IOException {
    Image originalImage = readImage(CAPEDWARF_PNG);
    Composite c1 = ImagesServiceFactory.makeComposite(originalImage, 0, 0, 1, Composite.Anchor.BOTTOM_LEFT);
    Image ci = imagesService.composite(newArrayList(c1), 200, 143, 0, new OutputSettings(OutputEncoding.JPEG));
    assertImages(null, originalImage, ci);
}
 
Example #13
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: CompositeTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testTransform() throws IOException {
    CompositeTransform transform = ImagesServiceFactory.makeCompositeTransform();
    transform.concatenate(ImagesServiceFactory.makeHorizontalFlip());
    transform.concatenate(ImagesServiceFactory.makeHorizontalFlip());
    Image originalImage = readImage(CAPEDWARF_PNG);
    Image result = imagesService.applyTransform(transform, originalImage);
    assertImages(transform, originalImage, result);

    transform = ImagesServiceFactory.makeCompositeTransform(newArrayList(ImagesServiceFactory.makeVerticalFlip(), ImagesServiceFactory.makeVerticalFlip()));
    originalImage = readImage(CAPEDWARF_PNG);
    result = imagesService.applyTransform(transform, originalImage);
    assertImages(transform, originalImage, result);
}
 
Example #14
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: TransformationsTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testResize() throws IOException {
    InputSettings inputSettings = new InputSettings();
    OutputSettings outputSettings = new OutputSettings(OutputEncoding.PNG);

    Image originalImage = readImage(CAPEDWARF_PNG);
    assertEquals(200, originalImage.getWidth());
    assertEquals(143, originalImage.getHeight());

    originalImage = readImage(CAPEDWARF_PNG);
    Image resizedImage = imagesService.applyTransform(ImagesServiceFactory.makeResize(400, 286), originalImage);
    assertEquals(400, resizedImage.getWidth());
    assertEquals(286, resizedImage.getHeight());

    originalImage = readImage(CAPEDWARF_PNG);
    resizedImage = waitOnFuture(imagesService.applyTransformAsync(ImagesServiceFactory.makeResize(400, 286), originalImage));
    assertEquals(400, resizedImage.getWidth());
    assertEquals(286, resizedImage.getHeight());

    originalImage = readImage(CAPEDWARF_PNG);
    resizedImage = imagesService.applyTransform(ImagesServiceFactory.makeResize(300, 286), originalImage, inputSettings, outputSettings);
    assertEquals(300, resizedImage.getWidth());
    assertEquals(215, resizedImage.getHeight());

    originalImage = readImage(CAPEDWARF_PNG);
    resizedImage = waitOnFuture(imagesService.applyTransformAsync(ImagesServiceFactory.makeResize(300, 286), originalImage, inputSettings, outputSettings));
    assertEquals(300, resizedImage.getWidth());
    assertEquals(215, resizedImage.getHeight());

    originalImage = readImage(CAPEDWARF_PNG);
    resizedImage = imagesService.applyTransform(ImagesServiceFactory.makeResize(400, 200), originalImage, outputSettings);
    assertEquals(280, resizedImage.getWidth());
    assertEquals(200, resizedImage.getHeight());
}
 
Example #15
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: TransformationsTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testResizeWithStretch() throws IOException {
    int resizedWidth = 300;
    int resizedHeight = 200;
    Image originalImage = readImage(CAPEDWARF_PNG);
    Transform resize = ImagesServiceFactory.makeResize(resizedWidth, resizedHeight, true);
    Image resizedImage = imagesService.applyTransform(resize, originalImage);

    assertEquals(resizedWidth, resizedImage.getWidth());
    assertEquals(resizedHeight, resizedImage.getHeight());
}
 
Example #16
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: ImagesServiceTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testFeelLucky() throws IOException {
    // I'm Feeling Lucky is not available in dev_appserver, CapeDwarf
    assumeEnvironment(Environment.APPSPOT);

    Transform transform = ImagesServiceFactory.makeImFeelingLucky();
    for (String sfile : FNAMES) {
        for (OutputEncoding encoding : ENCODES) {
            applyAndVerify(sfile, transform, ChkType.FLIP, encoding);
        }
    }
}
 
Example #17
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: ImagesServiceTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testHorizontalFlip() throws IOException {
    ChkType chkType = ChkType.FLIP;
    Transform transform = ImagesServiceFactory.makeHorizontalFlip();
    for (String sfile : FNAMES) {
        for (OutputEncoding encoding : ENCODES) {
            applyAndVerify(sfile, transform, chkType, encoding);
        }
    }
}
 
Example #18
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: ImagesServiceTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testVerticalFlip() throws IOException {
    ChkType chkType = ChkType.FLIP;
    Transform transform = ImagesServiceFactory.makeVerticalFlip();
    for (String sfile : FNAMES) {
        for (OutputEncoding encoding : ENCODES) {
            applyAndVerify(sfile, transform, chkType, encoding);
        }
    }
}
 
Example #19
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: ImagesServiceTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testResize() throws IOException {
    for (String sfile : FNAMES) {
        for (int[] exptSize : NEW_SIZES) {
            Transform transform = ImagesServiceFactory.makeResize(exptSize[0], exptSize[1]);
            for (OutputEncoding encoding : ENCODES) {
                Image image = imagesService.applyTransform(transform, readImage(sfile), encoding);
                assertTrue((exptSize[0] == image.getWidth()) || (exptSize[1] == image.getHeight()));
            }
        }
    }
}
 
Example #20
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: ImagesServiceTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testCrop() throws IOException {
    ChkType chkType = ChkType.CROP;
    String cropLeftX = "0.0";
    String cropTopY = "0.0";
    String cropRightX = "0.5";
    String cropBottomY = "0.5";
    Transform transform = ImagesServiceFactory.makeCrop(new Float(cropLeftX), new Float(cropTopY), new Float(cropRightX), new Float(cropBottomY));
    for (OutputEncoding encoding : ENCODES) {
        applyAndVerify("pngAttach.png", transform, chkType, encoding);
    }
}
 
Example #21
Source Project: solutions-photo-sharing-demo-java   Author: GoogleCloudPlatform   File: PhotoServiceManager.java    License: Apache License 2.0 5 votes vote down vote up
public String getPhotoDisplayUrl(BlobKey blobKey) {
  ServingUrlOptions options = ServingUrlOptions.Builder.withBlobKey(blobKey);
  options.imageSize(configManager.getPhotoThumbnailSizeInPixels());
  options.crop(configManager.isPhotoThumbnailCrop());
  try {
    return ImagesServiceFactory.getImagesService().getServingUrl(options);
  } catch (ImagesServiceFailureException e) {
    logger.severe("Failed to get image serving url: " + e.getMessage());
    return "";
  }
}
 
Example #22
Source Project: appinventor-extensions   Author: mit-cml   File: GalleryServiceImpl.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * when an app is published/updated, we need to move the image
 * that was temporarily uploaded into projects/projectid/image
 * into the gallery image
 * @param app gallery app
 */
private void setGalleryAppImage(GalleryApp app) {
  // best thing would be if GCS has a mv op, we can just do that.
  // don't think that is there, though, so for now read one and write to other
  // First, read the file from projects name
  boolean lockForRead = false;
  //String projectImageKey = app.getProjectImageKey();
  GallerySettings settings = loadGallerySettings();
  String projectImageKey = settings.getProjectImageKey(app.getProjectId());
  try {
    GcsService gcsService = GcsServiceFactory.createGcsService();
    //GcsFilename filename = new GcsFilename(GalleryApp.GALLERYBUCKET, projectImageKey);
    GcsFilename filename = new GcsFilename(settings.getBucket(), projectImageKey);
    GcsInputChannel readChannel = gcsService.openReadChannel(filename, 0);
    InputStream gcsis = Channels.newInputStream(readChannel);

    byte[] buffer = new byte[8000];
    int bytesRead = 0;
    ByteArrayOutputStream bao = new ByteArrayOutputStream();

    while ((bytesRead = gcsis.read(buffer)) != -1) {
      bao.write(buffer, 0, bytesRead);
    }
    // close the project image file
    readChannel.close();

    // if image is greater than 200 X 200, it will be scaled (200 X 200).
    // otherwise, it will be stored as origin.
    byte[] oldImageData = bao.toByteArray();
    byte[] newImageData;
    ImagesService imagesService = ImagesServiceFactory.getImagesService();
    Image oldImage = ImagesServiceFactory.makeImage(oldImageData);
    //if image size is too big, scale it to a smaller size.
    if(oldImage.getWidth() > 200 && oldImage.getHeight() > 200){
        Transform resize = ImagesServiceFactory.makeResize(200, 200);
        Image newImage = imagesService.applyTransform(resize, oldImage);
        newImageData = newImage.getImageData();
    }else{
        newImageData = oldImageData;
    }

    // set up the cloud file (options)
    // After publish, copy the /projects/projectId image into /apps/appId
    //String galleryKey = app.getImageKey();
    String galleryKey = settings.getImageKey(app.getGalleryAppId());

    //GcsFilename outfilename = new GcsFilename(GalleryApp.GALLERYBUCKET, galleryKey);
    GcsFilename outfilename = new GcsFilename(settings.getBucket(), galleryKey);
    GcsFileOptions options = new GcsFileOptions.Builder().mimeType("image/jpeg")
        .acl("public-read").cacheControl("no-cache").build();
    GcsOutputChannel writeChannel = gcsService.createOrReplace(outfilename, options);
    writeChannel.write(ByteBuffer.wrap(newImageData));

    // Now finalize
    writeChannel.close();

  } catch (IOException e) {
    // TODO Auto-generated catch block
    LOG.log(Level.INFO, "FAILED WRITING IMAGE TO GCS");
    e.printStackTrace();
  }
}
 
Example #23
Source Project: java-docs-samples   Author: GoogleCloudPlatform   File: ImagesServlet.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {

  // [START original_image]
  // Read the image.jpg resource into a ByteBuffer.
  FileInputStream fileInputStream = new FileInputStream(new File("WEB-INF/image.jpg"));
  FileChannel fileChannel = fileInputStream.getChannel();
  ByteBuffer byteBuffer = ByteBuffer.allocate((int) fileChannel.size());
  fileChannel.read(byteBuffer);

  byte[] imageBytes = byteBuffer.array();

  // Write the original image to Cloud Storage
  gcsService.createOrReplace(
      new GcsFilename(bucket, "image.jpeg"),
      new GcsFileOptions.Builder().mimeType("image/jpeg").build(),
      ByteBuffer.wrap(imageBytes));
  // [END original_image]

  // [START resize]
  // Get an instance of the imagesService we can use to transform images.
  ImagesService imagesService = ImagesServiceFactory.getImagesService();

  // Make an image directly from a byte array, and transform it.
  Image image = ImagesServiceFactory.makeImage(imageBytes);
  Transform resize = ImagesServiceFactory.makeResize(100, 50);
  Image resizedImage = imagesService.applyTransform(resize, image);

  // Write the transformed image back to a Cloud Storage object.
  gcsService.createOrReplace(
      new GcsFilename(bucket, "resizedImage.jpeg"),
      new GcsFileOptions.Builder().mimeType("image/jpeg").build(),
      ByteBuffer.wrap(resizedImage.getImageData()));
  // [END resize]

  // [START rotate]
  // Make an image from a Cloud Storage object, and transform it.
  BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
  BlobKey blobKey = blobstoreService.createGsBlobKey("/gs/" + bucket + "/image.jpeg");
  Image blobImage = ImagesServiceFactory.makeImageFromBlob(blobKey);
  Transform rotate = ImagesServiceFactory.makeRotate(90);
  Image rotatedImage = imagesService.applyTransform(rotate, blobImage);

  // Write the transformed image back to a Cloud Storage object.
  gcsService.createOrReplace(
      new GcsFilename(bucket, "rotatedImage.jpeg"),
      new GcsFileOptions.Builder().mimeType("image/jpeg").build(),
      ByteBuffer.wrap(rotatedImage.getImageData()));
  // [END rotate]

  // [START servingUrl]
  // Create a fixed dedicated URL that points to the GCS hosted file
  ServingUrlOptions options =
      ServingUrlOptions.Builder.withGoogleStorageFileName("/gs/" + bucket + "/image.jpeg")
          .imageSize(150)
          .crop(true)
          .secureUrl(true);
  String url = imagesService.getServingUrl(options);
  // [END servingUrl]

  // Output some simple HTML to display the images we wrote to Cloud Storage
  // in the browser.
  PrintWriter out = resp.getWriter();
  out.println("<html><body>\n");
  out.println(
      "<img src='//storage.cloud.google.com/" + bucket + "/image.jpeg' alt='AppEngine logo' />");
  out.println(
      "<img src='//storage.cloud.google.com/"
          + bucket
          + "/resizedImage.jpeg' alt='AppEngine logo resized' />");
  out.println(
      "<img src='//storage.cloud.google.com/"
          + bucket
          + "/rotatedImage.jpeg' alt='AppEngine logo rotated' />");
  out.println("<img src='" + url + "' alt='Hosted logo' />");
  out.println("</body></html>\n");
}
 
Example #24
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: TifImageTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testHorizontalFlip() throws IOException {
    assumeEnvironment(Environment.APPSPOT, Environment.CAPEDWARF);
    Transform transform = ImagesServiceFactory.makeHorizontalFlip();
    assertTransformation(transform, "HorizontalFlip");
}
 
Example #25
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: TifImageTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testVerticalFlip() throws IOException {
    assumeEnvironment(Environment.APPSPOT, Environment.CAPEDWARF);
    Transform transform = ImagesServiceFactory.makeVerticalFlip();
    assertTransformation(transform, "VerticalFlip");
}
 
Example #26
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: TifImageTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testFeelingLucky() throws IOException {
    assumeEnvironment(Environment.APPSPOT);
    Transform transform = ImagesServiceFactory.makeImFeelingLucky();
    assertTransformation(transform, "ImFeelingLucky");
}
 
Example #27
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: MakeImageTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void blobKeyImage() throws IOException {
    Image i1 = ImagesServiceFactory.makeImageFromBlob(new BlobKey("gs/bucket/123"));
    Image i2 = ImagesServiceFactory.makeImageFromFilename("/gs/bucket/123");
    assertEquals(i1, i2); // should compare blob keys
}
 
Example #28
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: MakeImageTest.java    License: Apache License 2.0 4 votes vote down vote up
private void assertMakeImageCanReadImage(byte[] imageData) {
    Image image = ImagesServiceFactory.makeImage(imageData);
    assertNotNull(image);
}
 
Example #29
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: ImagesServiceTestBase.java    License: Apache License 2.0 4 votes vote down vote up
@Before
public void init() throws Exception {
    imagesService = ImagesServiceFactory.getImagesService();
}
 
Example #30
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: ImagesServiceTestBase.java    License: Apache License 2.0 4 votes vote down vote up
protected Image readImage(String filename) throws IOException {
    return ImagesServiceFactory.makeImage(toByteArray(getImageStream(filename)));
}