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
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Lossless jpeg transformations
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

John

USA
94 Posts

Posted - Oct 28 2013 :  19:38:04  Show Profile  Reply
I understand the issue of jpeg image degradation when the image is repeatedly loaded and saved. The question is what if a jpeg image is loaded into an ImageEnView component where it is rotated and then the rotated image is moved into a second ImageEnView component without an intervening saving of the image. Will there be a loss of image quality between the first and second image even though the image was not saved? An example of this is given in the four lines of code below.

ImageEnViewLeft.Proc.Rotate(wwDBSpinEditRotate.Value, ESBCheckBox1.Checked, ierBiCubic, -1); // requires ImageEnProc unit
ImageEnViewMiddle.Assign(ImageEnViewLeft);
ImageEnViewMiddle.IO.Params.Assign(ImageEnViewLeft.IO.Params);
ImageEnViewMiddle.Fit;

The point to the question is whether in the above situation, the JPEGlosslessTransform function needs to be used in the first line of code above and then the saved image placed into the second ImageEnView component. Obviously, there is a great deal more disk and cpu activity required if the JPEGLosslessTransform procedure is required.

TIA

John


xequte

39109 Posts

Posted - Oct 28 2013 :  22:11:39  Show Profile  Reply
Hi John

When you are assigning an image from one TImageEnView to another (or to/from another destination, such as a TIEBitmap, TBitmap, TGraphic, etc) it is a bitmap that you are assigning, so there is no loss of quality even if the image type was originally JPEG.

IOW, your code above does not cause image degradation.

JPEG degradation occurs only at the point where an image is saved to file (IO.SaveToFile) or stream (IO.SaveToStream), assuming you do not use a lossless method.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

John

USA
94 Posts

Posted - Nov 04 2013 :  05:58:04  Show Profile  Reply
If multiple transformations are made to an object and with each transformation the image is placed in a new ImageEnView component then:

a) is there a mechanism to save the image in the last ImageEnView component in a lossless manner directly from the ImageEnView component without saving the image after each individual transformation is made?

b) is there a mechanism to save a rotated image in a lossless manner when it is rotated some number of degrees that does not correspond to the 90, 180 and 270 degrees defined by TIEJpegTransform?

c) if b) is possible would this also apply to images where properties not included in the TIEJpegTransform list were modified, i.e. brightness, intensity, etc.


As a separate question, if the transformation is not jtCut and there is no selected cropbox to define tempRect, then how does one define the CutRect in JpegLosslessTransform?



TIA

John


Go to Top of Page

xequte

39109 Posts

Posted - Nov 04 2013 :  11:52:49  Show Profile  Reply
Hi John

a. No, lossless functions work on a file only. You could track the changes made to an image and if they are supported by lossless JPEG functionality then perform a lossless crop on the source file, rather than saving the image from the ImageEnView

b. No, that is not possible. Lossless transformations were never a part of the JPEG standard, they are an unofficial, but widely used retrofit, so there is no technical way to perform irregular rotations.

c. No, again, not technically possible

d. If you are not cropping (jtCut) then the value of the rect is irrelevant, i.e. you can just specify it as Rect(0, 0, 0, 0)

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

John

USA
94 Posts

Posted - Nov 06 2013 :  14:11:19  Show Profile  Reply
Nigel

Thanks for the clarification

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