I'm not an expert in Java.. I was wondering if there is a method, to get the first image of a result of searching an Image on Google Images from a String.
If yes, what is the easiest and fastest method to do it?
Thanks in advance!
I'm not an expert in Java.. I was wondering if there is a method, to get the first image of a result of searching an Image on Google Images from a String.
If yes, what is the easiest and fastest method to do it?
Thanks in advance!
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()));