I rotate jpeg (with llj.transform()) and change exif orintation (with LLJTran.OPT_XFORM_ORIENTATION). Everything is working (no error, no exception). In my photo browser (gqview) it looks like good too (jpeg is rotated end exif orientation is changed).
But if I run this operation again on new file (from previous rotation) I got BAD exif orientation (from original file - not changed).
There are two places in exif directories with orientation??? Where is the problem???
My code:
Directory exif = imageInfo.getDirectory(ExifDirectory.class);
int orientation = exif.getInt(ExifDirectory.TAG_ORIENTATION);
switch (orientation) {
case EXIF_LEFT_ROTATED:
Utils.transformJPEG(_file, Utils.JPEG_OPERATION_ROTATE_90);
return EXIF_LEFT_ROTATED;
case EXIF_RIGHT_ROTATED:
Utils.transformJPEG(_file, Utils.JPEG_OPERATION_ROTATE_270);
return EXIF_RIGHT_ROTATED;
}
public void transformJPEG(File _fileToRotate, int _operation) {
LLJTran llj = new LLJTran(_fileToRotate);
llj.read(LLJTran.READ_ALL, true);
int options = LLJTran.OPT_DEFAULTS | LLJTran.OPT_XFORM_ORIENTATION;
llj.transform(_operation, options);
File tmpFile = File.createTempFile("CDnavigatorRotate", "jpg");
OutputStream out = new BufferedOutputStream(new FileOutputStream(tmpFile));
llj.save(out, LLJTran.OPT_WRITE_ALL);
out.close();
llj.freeMemory();
}
I use lib mediautil.jar from package MediaChest-148.zip
My OS Linux FC6, PC, java version "1.5.0_10"
email: j.myslivec@gmc.net
Thank you for answer
Jindrich Myslivec
Anonymous