try
{
ImageData imageData = new ImageData( new ByteArrayInputStream( this.newImageRawData ) );
if ( imageData.type != this.requiredImageType )
{
ImageLoader imageLoader = new ImageLoader();
imageLoader.data = new ImageData[]
{ imageData };
ByteArrayOutputStream baos = new ByteArrayOutputStream();
imageLoader.save( baos, this.requiredImageType );
this.newImageRawDataInRequiredFormat = baos.toByteArray();
}
else
{
this.newImageRawDataInRequiredFormat = this.newImageRawData;