Skip to Main Content

Changing image orientation while saving to file

f6df8302-abef-455f-9673-7dcd611acd52Jul 30 2014 — edited Jul 30 2014

I get a Base64Encoded image string (GIF format) from an external system. While reading the byte array and saving the image to file, the image gets saved in landscape orientation.

The code snippet is below.

String image = "R0lGODdhCAcgA=";

Base64Coder decoder = new Base64Coder();

byte [] decodeBytes = decoder.decode(image.getBytes());

ByteArrayInputStream stream = new ByteArrayInputStream(pngArray);

BufferedImage bImage = ImageIO.read(stream);

File label = new File("C:/labels/test.gif");

ImageIO.write(bImage, "gif", label);

I want to save the image in portrait orientation. Is there a way to do that?

Comments
Post Details
Added on Jul 30 2014
2 comments
954 views