ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Rotation of an Image without a loss of quality

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
DRIGUS Posted - May 19 2020 : 08:36:03
Hello,
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;
begin
  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;
  end;

  FImage.IO.Params.EXIF_HasEXIFData := True; 
  FImage.IO.Params.TIFF_Orientation := FImage.IO.Params.EXIF_Orientation;
  SaveFile;
  OpenFile;
end;

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?
Greetings
2   L A T E S T    R E P L I E S    (Newest First)
DRIGUS Posted - May 20 2020 : 09:43:57
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.


xequte Posted - May 19 2020 : 16:41:37
Hi

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:

https://www.imageen.com/help/JpegLosslessTransform2.html

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

https://www.imageen.com/help/IEAutomaticallyRotateImageFile.html


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:

https://www.imageen.com/help/TIOParams.JPEG_Quality.html

Nigel
Xequte Software
www.imageen.com