Created
November 19, 2019 06:30
-
-
Save ESidenko/749eb4262bef8ba92cc5ac65087624f4 to your computer and use it in GitHub Desktop.
Image load/save indication progress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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