Question: I need to display different size of a UIImage depending on the UIInterfaceOrientation. Now the problem is, everytime the program changes its orientation the image is still there and the new one is overlapping it. Here's what I have

```
UIView *logoView;

UIImage *image = [UIImage imageNamed:@"pic.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[logoView removeFromSuperview];
CGRect rect;
UIInterfaceOrientation newOrientation =  [UIApplication sharedApplication].statusBarOrientation;
if(newOrientation == UIInterfaceOrientationLandscapeLeft || newOrientation == UIInterfaceOrientationLandscapeRight)
{
    rect = CGRectMake(0, 0, self.view.bounds.size.width/2, self.view.bounds.size.height/4);
    logoView = [[UIView alloc] initWithFrame:CGRectMake(0,0,self.view.bounds.size.width/2, self.view.bounds.size.height/4)];
}

else if (newOrientation == UIInterfaceOrientationPortrait || newOrientation == UIInterfaceOrientationPortraitUpsideDown)
{
    rect = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height/4);
    logoView = [[UIView alloc] initWithFrame:CGRectMake(0,0,self.view.bounds.size.width, self.view.bounds.size.height/4)];
}
imageView.frame = logoView.bounds;
[logoView addSubview:imageView];

[self.view addSubview:logoView];

```

Answer: 
In your first step you are encoding it to Base64. To get binary data is to decode it back. :) You can do it like below

```
byte[] byteArr = Base64.decode("Pass BASE64 String here", Base64.DEFAULT);

```
```
Bitmap to Base64 (Java)
private String bitmapToBase64(Bitmap bitmap)
{
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream .toByteArray();
return Base64.encodeToString(byteArray, Base64.DEFAULT);
}

```