ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder
ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Rotation of an Image without a loss of quality
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  


12 Posts

Posted - May 19 2020 :  08:36:03  Show Profile  Reply
I want to build an Application that rotates an Image clockwise or counterclockwise. Whereby the quality of the Image should not be changed. I use the following code to implement the Funcionality:

procedure tImageEnItem.RotationCounterClockwise;
  case FImage.IO.Params.EXIF_Orientation of  
    0: FImage.IO.Params.EXIF_Orientation := 8;
    1: FImage.IO.Params.EXIF_Orientation := 8;
    8: FImage.IO.Params.EXIF_Orientation := 3;
    3: FImage.IO.Params.EXIF_Orientation := 6;
    6: FImage.IO.Params.EXIF_Orientation := 1;

  FImage.IO.Params.EXIF_HasEXIFData := True; 
  FImage.IO.Params.TIFF_Orientation := FImage.IO.Params.EXIF_Orientation;

Now I have the Problem, that my Code changes the Image. I added an Example.

The original One is the following:

After 100 rotations I get the following result:

Am I doing something wrong?


5227 Posts

Posted - May 19 2020 :  16:41:37  Show Profile  Reply

JPEG is a lossy format, which means that every time it is saved a little bit of the image information is thrown away to make it compress better.

To negate or reduce this, you have two options:

1. Lossless JPEG rotation:

If you use the JpegLosslessTransform2 method, then there will be no reduction in quality:

In fact, there is already a method to automatically load, rotate and then save images based on EXIF data:

2. Specify a much higher JPEG quality value

You don't show your saving code, so I can only guess you are using a lower or default JPEG quality. You should increase that:

Xequte Software
Go to Top of Page


12 Posts

Posted - May 20 2020 :  09:43:57  Show Profile  Reply
Hey Nigel,
Thank you for you're Help.
I already set the JPEG-Quality at 100%.
But the clue, with the jpeglosslessTransform2 method, helped me.
Thanks a lot.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To: