// Raise the Debug Level which is normally LEVEL_INFO. Only Warning
// messages will be printed by MediaUtil.
Log.debugLevel = Log.LEVEL_NONE;
// 1. Initialize LLJTran and Read the entire Image including Appx markers
LLJTran llj = new LLJTran(input);
// If you pass the 2nd parameter as false, Exif information is not
// loaded and hence will not be written.
llj.read(LLJTran.READ_ALL, true);
// 2. Transform the image using default options along with
// transformation of the Orientation tags. Try other combinations of
// LLJTran_XFORM.. flags. Use a jpeg with partial MCU (partialMCU.jpg)
// for testing LLJTran.XFORM_TRIM and LLJTran.XFORM_ADJUST_EDGES
int options = LLJTran.OPT_DEFAULTS | LLJTran.OPT_XFORM_ORIENTATION;
llj.transform(op, options);
// 3. Save the Image which is already transformed as specified by the
// input transformation in Step 2, along with the Exif header.
try (OutputStream out = new BufferedOutputStream(output)) {
llj.save(out, LLJTran.OPT_WRITE_ALL);
}
// Cleanup
input.close();
llj.freeMemory();
}