Forum Stats

  • 3,838,964 Users
  • 2,262,431 Discussions
  • 7,900,822 Comments

Discussions

Changing image orientation while saving to file

f6df8302-abef-455f-9673-7dcd611acd52
edited Jul 30, 2014 9:19PM in Java Programming

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?

Tagged:

Answers

This discussion has been closed.