3

so far i m trying

BufferedImage img = ImageIO.read(new ByteArrayInputStream(bytes));

but its give an error does don't support ImageIO in Apps engine.

2 Answers 2

2

The Image service Java API lets you apply transformations to images, The app prepares an Image object with the image data to transform, and a Transform object with instructions on how to transform the image, Check this link

 byte[] oldImageData;  // ...

        ImagesService imagesService = ImagesServiceFactory.getImagesService();

        Image oldImage = ImagesServiceFactory.makeImage(oldImageData);
        Transform resize = ImagesServiceFactory.makeResize(200, 300);

        Image newImage = imagesService.applyTransform(resize, oldImage);

        byte[] newImageData = newImage.getImageData();
Sign up to request clarification or add additional context in comments.

Comments

1

App Engine works in a sandbox, thus a lot of Java libraries are not accessible. For details, see this link [1].

The workaround provided in the other answer let's your buffer an image but it doesn't directly answer your question why you got the ImageIO error.

[1] - JRE whitelist for Google App Engine - https://cloud.google.com/appengine/docs/java/jrewhitelist

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.