public static Report renameImagesAsUnique(Report report) {
        JasperContent reportContent = (JasperContent) report.getContent();
		try {
			String masterContent = new String(reportContent.getMaster().getDataProvider().getBytes(), "UTF-8");
			for (JcrFile imageFile : reportContent.getImageFiles()) {
				String oldName = imageFile.getName();
				int index = oldName.lastIndexOf(ReportUtil.EXTENSION_SEPARATOR);
				String newName = oldName.substring(0, index) + ReportUtil.IMAGE_DELIM + UUID.randomUUID().toString()
						+ oldName.substring(index);
				masterContent = masterContent.replaceAll(oldName, newName);
				imageFile.setName(newName);
			}
			reportContent.getMaster().setDataProvider(new JcrDataProviderImpl(masterContent.getBytes("UTF-8")));
		} catch (UnsupportedEncodingException e) {
			LOG.error("Error inside JasperUtil.renameImagesAsUnique: " + e.getMessage(), e);
			e.printStackTrace();
		}

        return report;
    }
public static Report renameImagesAsUnique ( Report report ) { JasperContent reportContent = ( JasperContent ) report . getContent ( ) ; try { String masterContent = new String ( reportContent . getMaster ( ) . getDataProvider ( ) . getBytes ( ) , "UTF-8" ) ; for ( JcrFile imageFile : reportContent . getImageFiles ( ) ) { String oldName = imageFile . getName ( ) ; int index = oldName . lastIndexOf ( ReportUtil . EXTENSION_SEPARATOR ) ; String newName = oldName . substring ( 0 , index ) + ReportUtil . IMAGE_DELIM + UUID . randomUUID ( ) . toString ( ) + oldName . substring ( index ) ; masterContent = masterContent . replaceAll ( oldName , newName ) ; imageFile . setName ( newName ) ; } reportContent . getMaster ( ) . setDataProvider ( new JcrDataProviderImpl ( masterContent . getBytes ( "UTF-8" ) ) ) ; } catch ( UnsupportedEncodingException e ) { LOG . error ( "Error inside JasperUtil.renameImagesAsUnique: " + e . getMessage ( ) , e ) ; e . printStackTrace ( ) ; } return report ; }
Images are in the master file