How to avoid losing metadata with "keep" and "preserve" checked?

XnConvert Multi Platform - Windows, MacOSX, Linux
Post Reply
tlhackque
Posts: 3
Joined: Fri Jun 15, 2018 10:10 am

How to avoid losing metadata with "keep" and "preserve" checked?

Post by tlhackque » Fri Jun 15, 2018 10:40 am

XnConvert 1.76

I use this flow:
.JPG from camera => IPTC (add copyright), Add mask (fixes background, makes background Alpha channel), crop, canvas resize => png
"Keep and add new value" is checked on the IPTC action.
"Keep original date/time attributes" and "Preserve Metadata" are checked.

.PNG (from pass 1) => change color depth (24 bits) - remove Alpha (replacing with white) => jpg
"Keep original date/time attributes", "Preserve Metadata", and "Delete original" are checked.
The JPeg conversion is Q = 60, optimize Huffman, Slow, 0, default, rebuild EXIF thumbnail.

According to Image::ExifTool: the original input JPEG has 117 attributes. The processed JPEG has only 27.

I really want the original metadata preserved - and I expect "keep original" and "preserve meta" to do this.

I do understand & expect that the physical file attributes will be different, and that I'm changing image dimensions.

However, I don't want to lose the orignal camera inforation, the datetimeoriginal, etc. Yet it disappears...

The reason is that the processed file is reduced for browsing, but I want the metadata to reflect the
raw file - which is off-line, but available on request. This is a batch process for on the order of 1,000
files - so manually restoring/transferring is not realistic.

What am I missing? How can I accomplish this?

Thanks in advance.

Input attributes:

Code: Select all

  x $a = Image::ExifTool->new
x  $a->Options( Binary => 0, Exclude => 'ThumbnailImage' )
x  sort keys %{$a->ImageInfo( 'F:images\raw\dsCN0300.jpg',{ Duplicates => 1})}
0  'AFAreaMode'
1  'AFPoint'
2  'AFPointsInFocus'
3  'Aperture'
4  'BitsPerSample'
5  'CircleOfConfusion'
6  'ColorComponents'
7  'ColorMode'
8  'ColorSpace'
9  'ComponentsConfiguration'
10  'CompressedBitsPerPixel'
11  'Compression'
12  'Compression (1)'
13  'Contrast'
14  'CreateDate'
15  'CustomRendered'
16  'DateTimeOriginal'
17  'DigitalZoom'
18  'DigitalZoomRatio'
19  'Directory'
20  'EncodingProcess'
21  'ExifByteOrder'
22  'ExifImageHeight'
23  'ExifImageWidth'
24  'ExifToolVersion'
25  'ExifVersion'
26  'ExposureCompensation'
27  'ExposureMode'
28  'ExposureProgram'
29  'ExposureTime'
30  'FNumber'
31  'FOV'
32  'FaceDetectFrameSize'
33  'FacesDetected'
34  'FileAccessDate'
35  'FileCreateDate'
36  'FileModifyDate'
37  'FileName'
38  'FilePermissions'
39  'FileSize'
40  'FileSource'
41  'FileType'
42  'FileTypeExtension'
43  'Flash'
44  'FlashSetting'
45  'FlashpixVersion'
46  'FocalLength'
47  'FocalLength35efl'
48  'FocalLengthIn35mmFormat'
49  'FocusMode'
50  'GainControl'
51  'HDR'
52  'HDRInfoVersion'
53  'HDRLevel'
54  'HDRLevel2'
55  'HDRSmoothing'
56  'HyperfocalDistance'
57  'ISO'
58  'ISO (1)'
59  'ISO (2)'
60  'ISO2'
61  'ISOExpansion'
62  'ISOExpansion2'
63  'ISOSelection'
64  'ImageDescription'
65  'ImageHeight'
66  'ImageProcessing'
67  'ImageSize'
68  'ImageStabilization'
69  'ImageWidth'
70  'InteropIndex'
71  'InteropVersion'
72  'LightSource'
73  'LightValue'
74  'MIMEType'
75  'Make'
76  'MakerNoteVersion'
77  'MaxApertureValue'
78  'Megapixels'
79  'MeteringMode'
80  'Model'
81  'ModifyDate'
82  'NoiseReduction'
83  'Orientation'
84  'PreviewImage'
85  'PreviewImageLength'
86  'PreviewImageStart'
87  'Quality'
88  'ResolutionUnit'
89  'ResolutionUnit (1)'
90  'ResolutionUnit (2)'
91  'RetouchHistory'
92  'Saturation'
93  'ScaleFactor35efl'
94  'SceneAssist'
95  'SceneCaptureType'
96  'SceneMode'
97  'SceneType'
98  'SensitivityType'
99  'Sharpness'
100  'ShutterSpeed'
101  'Software'
102  'SubjectDistanceRange'
103  'ThumbnailLength'
104  'ThumbnailOffset'
105  'UserComment'
106  'WhiteBalance'
107  'WhiteBalance (1)'
108  'WhiteBalanceFineTune'
109  'XResolution'
110  'XResolution (1)'
111  'XResolution (2)'
112  'YCbCrPositioning'
113  'YCbCrPositioning (1)'
114  'YCbCrSubSampling'
115  'YResolution'
116  'YResolution (1)'
117  'YResolution (2)'
 
Result:

Code: Select all

x $a->Options( Binary => 0, Exclude => 'ThumbnailImage' )
x sort keys %{$a->ImageInfo( 'F:images\resized\dsCN0300_resized.jpg',{ Duplicates => 1})}
0  'BitsPerSample'
1  'ColorComponents'
2  'Compression'
3  'Directory'
4  'EncodingProcess'
5  'ExifByteOrder'
6  'ExifToolVersion'
7  'FileAccessDate'
8  'FileCreateDate'
9  'FileModifyDate'
10  'FileName'
11  'FilePermissions'
12  'FileSize'
13  'FileType'
14  'FileTypeExtension'
15  'ImageHeight'
16  'ImageSize'
17  'ImageWidth'
18  'JFIFVersion'
19  'MIMEType'
20  'Megapixels'
21  'ModifyDate'
22  'ResolutionUnit'
23  'ThumbnailLength'
24  'ThumbnailOffset'
25  'XResolution'
26  'YCbCrSubSampling'
27  'YResolution'
  

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

Re: How to avoid losing metadata with "keep" and "preserve" checked?

Post by xnview » Fri Jun 15, 2018 11:58 am

PNG format doesn't support EXIF metadata
Pierre.

tlhackque
Posts: 3
Joined: Fri Jun 15, 2018 10:10 am

Re: How to avoid losing metadata with "keep" and "preserve" checked?

Post by tlhackque » Fri Jun 15, 2018 12:45 pm

xnview wrote:
Fri Jun 15, 2018 11:58 am
PNG format doesn't support EXIF metadata
Sigh, I missed that. Can you recommend another format that does (and that also supports the alpha channel, which is how I remove background)? I don't really care about the intermediate file - it's just a way to let me get rid of themasked backgroun. Or suggest another approach?

Thanks.

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

Re: How to avoid losing metadata with "keep" and "preserve" checked?

Post by xnview » Fri Jun 15, 2018 1:14 pm

why do have this step (PNG)?
Pierre.

tlhackque
Posts: 3
Joined: Fri Jun 15, 2018 10:10 am

Re: How to avoid losing metadata with "keep" and "preserve" checked?

Post by tlhackque » Fri Jun 15, 2018 3:40 pm

xnview wrote:
Fri Jun 15, 2018 1:14 pm
why do have this step (PNG)?
The original images have the subject in a fixed place. They have a known shape.

But the background is bad. i need to replace it with white.

I apply a mask in the first step - this replaces the background with black & leaves the object as desired.

But I want a white background. To do this, in the mask step, I use the mask for alpha, making the background transparent.

This I save as a png.

Then i convert the PNG back to jpeg - setting the conversion to TrueColor, which replaces the alpha (background) with white.
This is what i want in the final product.

It would be easier if i could replace the background with a different color at the mask step, but i couldn't make that work.

The PNG is just the itermediate step that lets me isolate the background in a way that it can be replaced.

If there's a better approach, i'd be happy to try it.

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

Re: How to avoid losing metadata with "keep" and "preserve" checked?

Post by xnview » Mon Jun 18, 2018 7:02 am

ok, do you have tried in tiff?
Pierre.

Post Reply