Lossless rotate question
Moderators: XnTriq, helmut, xnview
-
- Posts: 119
- Joined: Wed Jun 02, 2010 6:23 am
Lossless rotate question
can i ask a question about Lossless rotate ?
does xnview store the rotate change in the exif only?
is this the meaning of Lossless rotate ?
thanks
does xnview store the rotate change in the exif only?
is this the meaning of Lossless rotate ?
thanks
-
- Author of XnView
- Posts: 44297
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
Re: Lossless rotate question
In Options/Browser>Misc, you can choose if you want to change only the EXIF flag or make a lossless rotation
Pierre.
-
- Posts: 134
- Joined: Mon Sep 03, 2007 1:00 pm
- Location: Germany
Re: Lossless rotate question
The current options look like this (v1.97.8):
This is unclear and misleading, because the change of the EXIF orientation tag is a special case of a lossless rotation and not independent. Therefore, the options should be displayed as follows:
If the lossless rotation is unchecked, the EXIF rotation option should be deactivated.
See also my post here from two and a half years ago: http://newsgroup.xnview.com/viewtopic.p ... 265#p58265
Code: Select all
[ ] Change EXIF orientation ONLY when possible (JPEG)
[ ] Use Lossless rotation when possible (JPEG)
Code: Select all
[ ] Use lossless rotation if possible (JPEG)
[ ] Only change the EXIF orientation tag
See also my post here from two and a half years ago: http://newsgroup.xnview.com/viewtopic.p ... 265#p58265
-- Karl
-
- Author of XnView
- Posts: 44297
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
Re: Lossless rotate question
No it's a different choice. You have lossless rotation (which change picture data), and EXIF orientation field
Pierre.
-
- Posts: 134
- Joined: Mon Sep 03, 2007 1:00 pm
- Location: Germany
Re: Lossless rotate question
The current display of the options is misleading. You cannot use them independently.
-- Karl
-
- Posts: 119
- Joined: Wed Jun 02, 2010 6:23 am
Re: Lossless rotate question
but what 's the meaning of lossless ? is the meaning a little loss of image quality?xnview wrote:No it's a different choice. You have lossless rotation (which change picture data), and EXIF orientation field
-
- XnThusiast
- Posts: 2010
- Joined: Wed Mar 17, 2004 8:33 pm
- Location: Sarasota Florida
Re: Lossless rotate question
Hi drugo...
Lossless rotation applies only to jpgs and other formats that use a "lossy" compression algorithm.
In order to reduce file size when saving the image to disk, the jpeg engine compresses the image data in a "lossy" manner... this means that the engine discards image information (either pixel position or color or both) in order to make the saved image file smaller. Conversely, when expanding the image out of the file to the display, the jpeg engine "estimates" the lost data and attempts to restore the image to as close to the original (in appearance) as it can. Naturally, since image data has been discarded, the original cannot never be completely restored.
The important thing to remember is that every time one loads a jpg and then saves it, more data is discarded. Eventually the loss of original image data becomes quite noticeable to the eye.
"Lossless rotation" attempts to avoid the loss of quality that happens when the file is saved (after the rotation has been applied). Lossless rotation takes into account mathematical characteristics of the jpeg compression to allow image rotation to occur "in place" (that is, without recompression) for images whose horizontal and vertical dimensions meet certain criteria.
So... use lossless rotation on jpgs.
I always recommend that one convert images from jpg to a lossless compression format (tiff, or png, or psd) before starting the editing/adjustment process. When the images have been rotated, corrected, or otherwise modified to the extent required, then (and only then) should the user convert them back to jpg for distribution as smaller files. (Lossless compression tends to make much large files than lossy compression does).
This topic has been discussed several times previously in the forum. It is actually more complicated than presented here, but you get the idea.
Lossless rotation applies only to jpgs and other formats that use a "lossy" compression algorithm.
In order to reduce file size when saving the image to disk, the jpeg engine compresses the image data in a "lossy" manner... this means that the engine discards image information (either pixel position or color or both) in order to make the saved image file smaller. Conversely, when expanding the image out of the file to the display, the jpeg engine "estimates" the lost data and attempts to restore the image to as close to the original (in appearance) as it can. Naturally, since image data has been discarded, the original cannot never be completely restored.
The important thing to remember is that every time one loads a jpg and then saves it, more data is discarded. Eventually the loss of original image data becomes quite noticeable to the eye.
"Lossless rotation" attempts to avoid the loss of quality that happens when the file is saved (after the rotation has been applied). Lossless rotation takes into account mathematical characteristics of the jpeg compression to allow image rotation to occur "in place" (that is, without recompression) for images whose horizontal and vertical dimensions meet certain criteria.
So... use lossless rotation on jpgs.
I always recommend that one convert images from jpg to a lossless compression format (tiff, or png, or psd) before starting the editing/adjustment process. When the images have been rotated, corrected, or otherwise modified to the extent required, then (and only then) should the user convert them back to jpg for distribution as smaller files. (Lossless compression tends to make much large files than lossy compression does).
This topic has been discussed several times previously in the forum. It is actually more complicated than presented here, but you get the idea.
John
-
- Posts: 134
- Joined: Mon Sep 03, 2007 1:00 pm
- Location: Germany
Re: Lossless rotate question
Lossless means no loss of image quality.
There are two methods for lossless rotation of JPEG images:
1. Reorganising the JPEG blocks (and resetting the EXIF orientation tag to the default value "1" if necessary).
Drawback: Works only then really lossless if the image size is an integer multiple of the JPEG block size (usually 8 pixels; with color subsampling 16 pixels). Otherwise up to 15 pixels at the right or lower image border are cropped.
2. Only changing the EXIF orientation tag (see e.g. here: http://sylvana.net/jpegcrop/exif_orientation.html)
Drawback: Older software (and maybe poor current software) does not respect the EXIF orientation tag.
It is not possible to use both at the same time, so there should not be two îndependent options.
Actually there is no reason for not using method 1 if it's possible without cropping. The question is what to do if this method is not possible: Either ask the user what to do, use method 2, perform a lossy rotation with recompressing the image, or use method 1 anyway and allow some cropping.
So the option could look like this:
There are two methods for lossless rotation of JPEG images:
1. Reorganising the JPEG blocks (and resetting the EXIF orientation tag to the default value "1" if necessary).
Drawback: Works only then really lossless if the image size is an integer multiple of the JPEG block size (usually 8 pixels; with color subsampling 16 pixels). Otherwise up to 15 pixels at the right or lower image border are cropped.
2. Only changing the EXIF orientation tag (see e.g. here: http://sylvana.net/jpegcrop/exif_orientation.html)
Drawback: Older software (and maybe poor current software) does not respect the EXIF orientation tag.
It is not possible to use both at the same time, so there should not be two îndependent options.
Actually there is no reason for not using method 1 if it's possible without cropping. The question is what to do if this method is not possible: Either ask the user what to do, use method 2, perform a lossy rotation with recompressing the image, or use method 1 anyway and allow some cropping.
So the option could look like this:
Code: Select all
Method for lossless JPEG rotation:
X JPEG block reorganisation
If this method will crop the image:
X Ask user what to do
O Only change the EXIF orientation tag
O Perform a lossy rotation with recompressing the image
O Allow cropping of up to 15 pixels at the right and lower border
O Only change the EXIF orientation tag
-- Karl
-
- Posts: 119
- Joined: Wed Jun 02, 2010 6:23 am
Re: Lossless rotate question
thank you so muchJohnFredC wrote:Hi drugo...
Lossless rotation applies only to jpgs and other formats that use a "lossy" compression algorithm.
In order to reduce file size when saving the image to disk, the jpeg engine compresses the image data in a "lossy" manner... this means that the engine discards image information (either pixel position or color or both) in order to make the saved image file smaller. Conversely, when expanding the image out of the file to the display, the jpeg engine "estimates" the lost data and attempts to restore the image to as close to the original (in appearance) as it can. Naturally, since image data has been discarded, the original cannot never be completely restored.
The important thing to remember is that every time one loads a jpg and then saves it, more data is discarded. Eventually the loss of original image data becomes quite noticeable to the eye.
"Lossless rotation" attempts to avoid the loss of quality that happens when the file is saved (after the rotation has been applied). Lossless rotation takes into account mathematical characteristics of the jpeg compression to allow image rotation to occur "in place" (that is, without recompression) for images whose horizontal and vertical dimensions meet certain criteria.
So... use lossless rotation on jpgs.
I always recommend that one convert images from jpg to a lossless compression format (tiff, or png, or psd) before starting the editing/adjustment process. When the images have been rotated, corrected, or otherwise modified to the extent required, then (and only then) should the user convert them back to jpg for distribution as smaller files. (Lossless compression tends to make much large files than lossy compression does).
This topic has been discussed several times previously in the forum. It is actually more complicated than presented here, but you get the idea.
-
- Posts: 119
- Joined: Wed Jun 02, 2010 6:23 am
Re: Lossless rotate question
thanks a lotKarl02 wrote:Lossless means no loss of image quality.
There are two methods for lossless rotation of JPEG images:
1. Reorganising the JPEG blocks (and resetting the EXIF orientation tag to the default value "1" if necessary).
Drawback: Works only then really lossless if the image size is an integer multiple of the JPEG block size (usually 8 pixels; with color subsampling 16 pixels). Otherwise up to 15 pixels at the right or lower image border are cropped.
2. Only changing the EXIF orientation tag (see e.g. here: http://sylvana.net/jpegcrop/exif_orientation.html)
Drawback: Older software (and maybe poor current software) does not respect the EXIF orientation tag.
It is not possible to use both at the same time, so there should not be two îndependent options.
Actually there is no reason for not using method 1 if it's possible without cropping. The question is what to do if this method is not possible: Either ask the user what to do, use method 2, perform a lossy rotation with recompressing the image, or use method 1 anyway and allow some cropping.
So the option could look like this:
Code: Select all
Method for lossless JPEG rotation: X JPEG block reorganisation If this method will crop the image: X Ask user what to do O Only change the EXIF orientation tag O Perform a lossy rotation with recompressing the image O Allow cropping of up to 15 pixels at the right and lower border O Only change the EXIF orientation tag
-
- Posts: 119
- Joined: Wed Jun 02, 2010 6:23 am
Re: Lossless rotate question
may i ask a question ?
but this feature in the screeshot is Lossless ?
but this feature in the screeshot is Lossless ?
-
- Posts: 119
- Joined: Wed Jun 02, 2010 6:23 am
Re: Lossless rotate question
but the author of the program saidJohnFredC wrote:Hi drugo...
Lossless rotation applies only to jpgs and other formats that use a "lossy" compression algorithm.
.
do i miss something?No it's a different choice. You have lossless rotation (which change picture data), and EXIF orientation field
thanks
-
- Posts: 134
- Joined: Mon Sep 03, 2007 1:00 pm
- Location: Germany
Re: Lossless rotate question
No change in XnView v2.32 (2015-03-16).
The options are displayed under Browser > Misc. > Rotation as follows:
They refer to the saving of rotated JPEG images. So they would better fit under General > Read/Write > JPEG > Rotation as follows (default):
These options should also be shown in the JPEG Lossless Transformations dialog window (directly or after clicking an "Options" button). See the following picture:
There should be an additional option:
[ ] Save current settings as defaults
Perhaps there could also be a preview window to see how the image will look after the transformation.
Here is a demo program for lossless JPEG rotate and crop: http://sylvana.net/jpegcrop/
The options are displayed under Browser > Misc. > Rotation as follows:
Code: Select all
[ ] Keep original date/time attributes
[ ] Change EXIF orientation ONLY when possible (JPEG)
[ ] Use Lossless rotation when possible (JPEG)
Code: Select all
Method for lossless JPEG rotation:
(*) Only change existing or add new EXIF orientation tag
( ) JPEG block transformation
If not all JPEG blocks are transformable:
( ) Allow cropping of up to 15 pixels at the right and/or
lower border of the original image
( ) Keep all pixels of the original image
( ) Only change existing or add new EXIF orientation tag
( ) Perform a lossy rotation with recompressing the image
(*) Ask user what to do
[X] Set EXIF orientation tag to "1" after JPEG block transformation
[X] Create backup file
[ ] Keep original file modification date/time
There should be an additional option:
[ ] Save current settings as defaults
Perhaps there could also be a preview window to see how the image will look after the transformation.
Here is a demo program for lossless JPEG rotate and crop: http://sylvana.net/jpegcrop/
You do not have the required permissions to view the files attached to this post.
Last edited by Karl02 on Tue Jun 23, 2015 2:36 pm, edited 1 time in total.
-- Karl
-
- Posts: 134
- Joined: Mon Sep 03, 2007 1:00 pm
- Location: Germany
Re: Lossless rotate question
I've created a new set of testimages for testing the lossless JPEG rotation.
Preview:
Specifications:
- colored borders with a width of 22 pixels
- JPEG block size is 16 pixels for chrominance (color subsampling 4:2:0)
- width and height are different and not a multiple of the JPEG block size (239 x 255 for normal orientation)
- JPEG optimized and progressive
- embedded thumbnails
- 4 different EXIF dates with different seconds:
-- 01) 0x9003 DateTimeOriginal
-- 02) 0x9004 DateTimeDigitized (CreateDate in ExifTool)
-- 03) 0x0132 ModifyDate for main image
-- 04) 0x0132 ModifyDate for thumbnail image
Download: Test in jpegcrop:
Preview:
Specifications:
- colored borders with a width of 22 pixels
- JPEG block size is 16 pixels for chrominance (color subsampling 4:2:0)
- width and height are different and not a multiple of the JPEG block size (239 x 255 for normal orientation)
- JPEG optimized and progressive
- embedded thumbnails
- 4 different EXIF dates with different seconds:
-- 01) 0x9003 DateTimeOriginal
-- 02) 0x9004 DateTimeDigitized (CreateDate in ExifTool)
-- 03) 0x0132 ModifyDate for main image
-- 04) 0x0132 ModifyDate for thumbnail image
Download: Test in jpegcrop:
You do not have the required permissions to view the files attached to this post.
-- Karl
-
- Posts: 134
- Joined: Mon Sep 03, 2007 1:00 pm
- Location: Germany
Re: Lossless rotate question
Perhaps it would be easier to avoid separate lossy and lossless JPEG transformation functions and use general JPEG transformation functions that work according to the options.
The options for the saving of transformed JPEG images should be in "General > Read/Write > JPEG > Transformation" and look as follows (default):
The options for the saving of transformed JPEG images should be in "General > Read/Write > JPEG > Transformation" and look as follows (default):
Code: Select all
Method for JPEG transformations (rotate/flip):
(*) Only change existing or add new EXIF orientation tag
( ) JPEG block transformation
If not all JPEG blocks are transformable:
( ) Allow cropping of up to 15 pixels at the right and/or
lower border of the original image
( ) Keep all pixels of the original image
( ) Only change existing or add new EXIF orientation tag
( ) Perform a lossy rotation with recompressing the image
(*) Ask user what to do
[X] Set EXIF orientation tag to "1" after JPEG block transformation
[X] Create backup file
[ ] Keep original file modification date/time
-- Karl