Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Image load/save indication progress
// Example of use of separate operation progress event handlers for load/export operations
String fileName = "some file to load";
LoadOptions loadOptions = new LoadOptions();
loadOptions.setProgressEventHandler(new ProgressEventHandler()
{
@Override
public void invoke(ProgressEventHandlerInfo info)
{
System.out.format("Load event %s : %d/%d\n", EventType.toString(EventType.class, info.getEventType())
, info.getValue(), info.getMaxValue());
}
});
try (Image image = Image.load(fileName, loadOptions))
{
PsdOptions psdOptions = new PsdOptions();
psdOptions.setProgressEventHandler(new ProgressEventHandler()
{
@Override
public void invoke(ProgressEventHandlerInfo info)
{
System.out.format("Export event %s : %d/%d\n", EventType.toString(EventType.class, info.getEventType())
, info.getValue(), info.getMaxValue());
}
});
image.save(fileName + ".psd", psdOptions);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.