Export to .tif introduces artifacts...

Ask for help and post your question on how to use XnView MP.

Moderators: XnTriq, xnview

Katamara
Posts: 63
Joined: Sun Apr 04, 2010 11:54 am

Export to .tif introduces artifacts...

Post by Katamara » Sun Jul 29, 2018 6:55 am

When I open a .jpg and save uncompressed to .tif, I'm getting artifacts in the .tif

Linux Mint 18, XnViewMp .90

1. Original: https://unsplash.com/photos/pHANr-CpbYM
2. Filename: wil-stewart-18242-unsplash.jpg
3. Export to uncompressed .tif (Below: XnViewMP v.90)

Image

Compare: (With ImageMagick http://www.imagemagick.org/)...
$ compare wil-stewart-18242-unsplash.jpg wil-stewart-18242-unsplash.tif wil_Result_XnviewMP.png

Result of Compare XnViewMp .jpg to .tif: (Red indicates differences);
https://biz.kwamsook.com/ImageMagick/wi ... viewMP.png

When I save as .tif with imagemagick vs. XnViewMP, no differences exist between the .jpg and the exported .tif,
but the exported XnViewMp .tif does.

For example, open .jpg and save as .tif with imagemagick;
$ convert wil-stewart-18242-unsplash.jpg wil-stewart-18242-unsplash.tif
$ compare wil-stewart-18242-unsplash.jpg wil-stewart-18242-unsplash.tif wil_Result_XnviewMP.png

Result of Compare using imagemagick's .tif;
https://biz.kwamsook.com/ImageMagick/wil_Result_im6.png
It's clean, no differences indicated in red.

Question: Isn't the export to .tif in XnViewMP from a .jpg supposed to result in an identical unaltered .tif ?

Thank you.

User avatar
xnview
Author of XnView
Posts: 29881
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Export to .tif introduces artifacts...

Post by xnview » Sun Aug 05, 2018 11:58 am

the difference comes with ICC profile, is it enabled on XnView?
Pierre.

Katamara
Posts: 63
Joined: Sun Apr 04, 2010 11:54 am

Re: Export to .tif introduces artifacts...

Post by Katamara » Mon Aug 06, 2018 7:09 am

Thanks for your reply Pierre.

General > ICC : Use ICC profile for montor (slower) = off
CMYK Profile used when embedded profile doesn't exist = off
Rendering Intent: Relative colorimetric

I've changed the above parameters... is that correct ?

Also, If I open a .webp image and export as .tif (uncompressed, no profile)... should the 2 images be identical ?

Best regards.

User avatar
xnview
Author of XnView
Posts: 29881
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Export to .tif introduces artifacts...

Post by xnview » Mon Aug 06, 2018 7:41 am

Katamara wrote:
Mon Aug 06, 2018 7:09 am
I've changed the above parameters... is that correct ?
do you have a change? ImageMagick by default use icc profile?
Pierre.

Katamara
Posts: 63
Joined: Sun Apr 04, 2010 11:54 am

Re: Export to .tif introduces artifacts...

Post by Katamara » Tue Aug 07, 2018 10:53 am

Maybe I'm doing something incorrect Pierre.

1. Save .jpg image to disk
2. Export .jpg in XnViewMP 0.90 to .tif (settings per image in 1st post)

Is it true that XnViewMP should not have any change in pixels between #1 and #2 above ?

Thank you.

User avatar
xnview
Author of XnView
Posts: 29881
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Export to .tif introduces artifacts...

Post by xnview » Thu Aug 09, 2018 9:29 am

Katamara wrote:
Tue Aug 07, 2018 10:53 am
Is it true that XnViewMP should not have any change in pixels between #1 and #2 above ?
if you don't use icc profile, yes
Pierre.

Katamara
Posts: 63
Joined: Sun Apr 04, 2010 11:54 am

Re: Export to .tif introduces artifacts...

Post by Katamara » Sat Aug 11, 2018 8:41 pm

Hello Pierre.

I might have identified the problem.

Problem: Although all options for write export are checked, the profile is not written to the .tif file,
which will cause a difference in exported .jpg to .tif when compared to each other.

Supporting tests;

1. Start With Original: wil-stewart-18242-unsplash.jpg

2. XnViewMP settings for Write (Export) to .tif
Image

3. Export (#1) With XnViewMP to .tif (Same Settings As 1st Example In Original Post), Filename: wil-stewart-18242-unsplash-Export-Xn.tif

4. Check with 'exiftool' If ICC or Profile Was Saved From Export;
Image
Note: Results Were No ICC or Profile Exist

4.a Check again with imagemagick's 'identify' if ICC or Profile Was Saved from Export;
$ $ identify -verbose wil-stewart-18242-unsplash-Export-Xn.tif | grep -i -E "icc|profile"
Note: No ICC or Profile

5. The original Metadata from wil-stewart-18242-unsplash.jpg
Image

I'm wondering if the ICC and/or Profile from the Original .jpg was preserved in the Exported .tif, the comparison
of the .jpg to the Exported .tif would be identical pixels ?

Thank you.

User avatar
XnTriq
Moderator & Librarian
Posts: 5291
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Export to .tif introduces artifacts...

Post by XnTriq » Sat Aug 11, 2018 10:45 pm

@Pierre: Could it be that HP's “known incorrect sRGB profile” (sRGB IEC61966-2.1) is the culprit (again)?

############ PS ############


JPEGsnoop: “Profile not embedded” & “Profile can't be used independently of embedded”

Code: Select all

*** Marker: APP2 (xFFE2) ***
  OFFSET: 0x00000014
  Length          = 3160
  Identifier      = [ICC_PROFILE]
    ICC Profile:
      Marker Number = 1 of 1
        Profile Size                      : 3144 bytes
        Preferred CMM Type                : 'Lino' (0x4C696E6F)
        Profile Version                   : 0.2.1.0 (0x02100000)
        Profile Device/Class              : Display Device profile ('mntr' (0x6D6E7472))
        Data Colour Space                 : rgbData ('RGB ' (0x52474220))
        Profile connection space (PCS)    : 'XYZ ' (0x58595A20)
        Profile creation date             : 1998-02-09 06:49:00
        Profile file signature            : 'acsp' (0x61637370)
        Primary platform                  : Microsoft Corporation ('MSFT' (0x4D534654))
        Profile flags                     : 0x00000000
        Profile flags                       > Profile not embedded
        Profile flags                       > Profile can't be used independently of embedded
        Device Manufacturer               : 'IEC ' (0x49454320)
        Device Model                      : 'sRGB' (0x73524742)
        Device attributes                 : 0x00000000_00000000
        Device attributes                   > Reflective
        Device attributes                   > Glossy
        Device attributes                   > Media polarity = negative
        Device attributes                   > Black & white media
        Rendering intent                  : Perceptual
        Profile creator                   : 'HP  ' (0x48502020)
        Profile ID                        : 0x00000000_00000000_00000000_00000000

Stuffware Photo Studio:

Code: Select all

┌───────────┬────────┬────────┬──────┬───────────────────────────────────────────────┐
│ Signature │ Offset │ Size   │ Type │ Value                                         │
├───────────┼────────┼────────┼──────┼───────────────────────────────────────────────┤
│ cprt      │ 0x0150 │ 0x0033 │ text │ Copyright (c) 1998 Hewlett-Packard Company    │
│ desc      │ 0x0184 │ 0x006c │ desc │ sRGB IEC61966-2.1                             │
│ wtpt      │ 0x01f0 │ 0x0014 │ XYZ  │ X:0000f351 Y:00010000 Z:000116cc              │
│ bkpt      │ 0x0204 │ 0x0014 │ XYZ  │ X:00000000 Y:00000000 Z:00000000              │
│ rXYZ      │ 0x0218 │ 0x0014 │ XYZ  │ X:00006fa2 Y:000038f5 Z:00000390              │
│ gXYZ      │ 0x022c │ 0x0014 │ XYZ  │ X:00006299 Y:0000b785 Z:000018da              │
│ bXYZ      │ 0x0240 │ 0x0014 │ XYZ  │ X:000024a0 Y:00000f84 Z:0000b6cf              │
│ dmnd      │ 0x0254 │ 0x0070 │ desc │ IEC http://www.iec.ch                         │
│ dmdd      │ 0x02c4 │ 0x0088 │ desc │ IEC 61966-2.1 Default RGB colour space - sRGB │
│ vued      │ 0x034c │ 0x0086 │ desc │ Reference Viewing Condition in IEC61966-2.1   │
│ view      │ 0x03d4 │ 0x0024 │ view │ Unknown                                       │
│ lumi      │ 0x03f8 │ 0x0014 │ XYZ  │ X:004c0956 Y:00500000 Z:00571fe7              │
│ meas      │ 0x040c │ 0x0024 │ meas │ Unknown                                       │
│ tech      │ 0x0430 │ 0x000c │ sig  │ CRT                                           │
│ rTRC      │ 0x043c │ 0x080c │ curv │ Unknown                                       │
│ gTRC      │ 0x043c │ 0x080c │ curv │ Unknown                                       │
│ bTRC      │ 0x043c │ 0x080c │ curv │ Unknown                                       │
└───────────┴────────┴────────┴──────┴───────────────────────────────────────────────┘

ICC Profile Inspector:

p151474.png

I extracted the profile embedded in wil-stewart-18242-unsplash.jpg

p151474.zip
wil-stewart-18242-unsplash.icc
(2.68 KiB) Downloaded 1 time

… and compared it to AdobeICCProfiles_end-user.zip\RGB Profiles\sRGB Color Space Profile.icm. They're 100% identical.

User avatar
xnview
Author of XnView
Posts: 29881
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Export to .tif introduces artifacts...

Post by xnview » Mon Aug 13, 2018 7:41 am

Katamara wrote:
Sat Aug 11, 2018 8:41 pm
I'm wondering if the ICC and/or Profile from the Original .jpg was preserved in the Exported .tif, the comparison
of the .jpg to the Exported .tif would be identical pixels ?
if you don't use 'settings>General>Icc>use ICC', the icc profile will be saved in tiff file
Pierre.

Katamara
Posts: 63
Joined: Sun Apr 04, 2010 11:54 am

Re: Export to .tif introduces artifacts...

Post by Katamara » Tue Aug 21, 2018 11:01 pm

Hello again.

Unresolved Problems;
XnViewMP 0.90 Linux export original .jpg to .tif does not export icc profile.

1. Start Image - (1st message in thread): wil-stewart-18242-unsplash.jpg (md5 = 72eed6fa2c4bdbd7ca4d3d28536fb8a3 )

2. XnViewMP Export .jpg to .tif ( All available options checked for export )
Result - wil-stewart-18242-unsplash_Xn-Export-Orig-Jpg.tif (md5 = 7932a14110894b2c26774f968e8a39b6 )
Link (Large File) : https://biz.kwamsook.com/ImageMagick/wi ... ig-Jpg.tif

3. XnviewMP view Exiftool tab;
a) Original Jpeg : https://biz.kwamsook.com/ImageMagick/Xn ... G_Win7.jpg
b) XnViewMP Export to Tif: https://biz.kwamsook.com/ImageMagick/Xn ... _Win7b.png

Questions;
a) How Can I preserve the same exported exif and profile metadata Exporting in XnViewMP from .jpg to .tif ?
b) What is the reason why the image comparison programs in Linux all show non-identical pixels after XnViewMP export from .jpg to .tif ?
c) Should the results of tests I've done in this thread be different in Windows 7 Pro or later, vs. Linux ?

Thank you for your attention to this matter.

Best regards.

User avatar
XnTriq
Moderator & Librarian
Posts: 5291
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Export to .tif introduces artifacts...

Post by XnTriq » Fri Aug 24, 2018 11:45 am

Do you get the same result with Save as…, Export…, and Batch convert…, Katamara?

Katamara
Posts: 63
Joined: Sun Apr 04, 2010 11:54 am

Re: Export to .tif introduces artifacts...

Post by Katamara » Fri Aug 24, 2018 7:23 pm

XnTriq,

Per your request;
md5sums:
803994d7e93da5359db11dc7ac514eb5 Compared_Original-Jpeg-to-Tif_BatchConvert.tif
803994d7e93da5359db11dc7ac514eb5 Compared_Original-Jpeg-to-Tif_SaveAs.tif
a57a565a4ac2a962dbfdb2418ab84cb7 Compared_Results-of-SaveAs-to-BatchConvert.tif
322d82fa45d7668238d32734d01a8ecf wil-stewart-18242-unsplash_Xn_BatchConvert.tif
322d82fa45d7668238d32734d01a8ecf wil-stewart-18242-unsplash_Xn_SaveAs.tif

Original Jpeg: 72eed6fa2c4bdbd7ca4d3d28536fb8a3 wil-stewart-18242-unsplash.jpg
https://biz.kwamsook.com/ImageMagick/Co ... splash.jpg


1) XnViewMP "Save As" Original Jpeg Saved To Tiff;
a) Result: https://biz.kwamsook.com/ImageMagick/Co ... SaveAs.tif
b) Compared To Original [Red Colors Are Non Identical Pixels]; https://biz.kwamsook.com/ImageMagick/Co ... SaveAs.tif

Code: Select all

$ compare wil-stewart-18242-unsplash.jpg wil-stewart-18242-unsplash_Xn_SaveAs.tif Compared_Original-Jpeg-to-Tif_SaveAs.tif
 

2) XnViewMP "Batch Convert" Original Jpeg Saved To Tiff;
a) Result: https://biz.kwamsook.com/ImageMagick/Co ... SaveAs.tif
b) Compared To Original [Red Colors Are Non Identical Pixels]; https://biz.kwamsook.com/ImageMagick/Co ... onvert.tif

Code: Select all

$ compare wil-stewart-18242-unsplash.jpg wil-stewart-18242-unsplash_Xn_BatchConvert.tif Compared_Original-Jpeg-to-Tif_BatchConvert.tif
 

Settings a)
Image

Setting b)
Image


3) Compare 1b) to 2b) = Identical [No Red Pixels]: https://biz.kwamsook.com/ImageMagick/Co ... onvert.tif

Code: Select all

$ compare Compared_Original-Jpeg-to-Tif_SaveAs.tif  Compared_Results-of-SaveAs-to-BatchConvert.tif Compared_Results-of-SaveAs-to-BatchConvert.tif
All methods produce the same results.

Best Regards.

User avatar
XnTriq
Moderator & Librarian
Posts: 5291
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Export to .tif introduces artifacts...

Post by XnTriq » Sat Aug 25, 2018 6:30 am

Katamara wrote:
Fri Aug 24, 2018 7:23 pm
All methods produce the same results.
Thanks for your detailed tests, Katamara!

Perhaps these differences are the result of errors or gamut clipping during color space conversion from YCbCr (JPEG) to sRGB (TIFF)?

Links of interest:
  • SourceForge.net
  • Little CMS
  • ArgyllCMS
  • CodeProject
  • Photography Stack Exchange
    • Losslessly batch convert many JPEGs to sRGB?
      It is normally the responsibility of the viewing software to convert from the color-space of the file to that of the display. From what I understand, you want to do the conversion yourself because you use programs that simply assume sRGB as a color-space.

      A lossless conversion is not possible for this. On a properly calibrated system you will also make things worse because you will lose accuracy by converting to sRGB and then lose accuracy when converting to your monitor's color-space.

      Nconvert can perform a lossy conversion for you:

      Code: Select all

      nconvert -icc_out sRGB.icc -o <output-filename> <input-filename>
      Assuming all files are in the same directory, for example you can on Linux:

      Code: Select all

      foreach x (*.jpg)
          nconvert -icc_out sRGB.icc -o $x:r_srgb.jpg $x
      For this you need nconvert and an icc profile for sRGB.

      On Windows you will use the FOR statement. I believe there is built-in help to get the proper syntax.

Katamara
Posts: 63
Joined: Sun Apr 04, 2010 11:54 am

Re: Export to .tif introduces artifacts...

Post by Katamara » Sat Aug 25, 2018 5:46 pm

XnTiq thanks for your replies.

I am unclear however why you provided many links, the issue has been stated by Pierre...,
I 'should' be able to save an opened .jpg in XnViewMP 0.90 Linux and save by some method to a .tif file with identical pixels...
Post by Katamara » Tue Aug 07, 2018 10:53 am
Maybe I'm doing something incorrect Pierre.

1. Save .jpg image to disk
2. Export .jpg in XnViewMP 0.90 to .tif (settings per image in 1st post)

Is it true that XnViewMP should not have any change in pixels between #1 and #2 above ?

Thank you.
---------------------------------------------------------------------------------------------------------------
Answer;

Post by xnview » Thu Aug 09, 2018 9:29 am

Katamara wrote: ↑
Tue Aug 07, 2018 10:53 am
Is it true that XnViewMP should not have any change in pixels between #1 and #2 above ?

if you don't use icc profile, yes
Pierre.
I believe there is no conversion from sRGB profile in the original .jpg, to the exported/saved/batch converted .tif

Unanswered Questions;
a) How Can I preserve the same exported exif and profile metadata Exporting in XnViewMP from .jpg to .tif ?
b) What is the reason why the image comparison programs in Linux all show non-identical pixels after XnViewMP export from .jpg to .tif ?
c) Should the results of tests I've done in this thread be different in Windows 7 Pro or later, vs. Linux ?

Best regards.

User avatar
XnTriq
Moderator & Librarian
Posts: 5291
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Export to .tif introduces artifacts...

Post by XnTriq » Sat Aug 25, 2018 10:30 pm

Hi Katamara (-:

The results of your tests have shown that the conversion with XnView MP v0.90 isn't (fully) lossless, although it should be. Your settings seem to be correct. As you've pointed out, “no differences exist between the .jpg and the exported .tif” with ImageMagick. This tells me that we're dealing with a bug.

Software like XnView often incorporates code from 3rd-party libraries:
\XnViewMP\plugins\imageformats\qtiff.dll is based on LibTIFF.

Sometimes, issues stem from such libraries. Case in point: libpng & sRGB IEC61966-2.1

Unfortunately, I'm far from an expert when it comes to color management, which is why I'm hoping that users with calibrated systems – be it on Linux, Windows or Mac – will eventually share some insight.

PS: Could you please post a screenshot of ToolsSettings…GeneralICC?

Post Reply