ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: Jom on July 26, 2022, 01:31:38 PM

Title: Broken markup of output if several groups
Post by: Jom on July 26, 2022, 01:31:38 PM
Hello, Phill.
If I use several groups, I get broken markup of output
[MakerNotes:Canon:Image] WhiteBalanceBlue       : 0
[MakerNotes:Canon:Image] WhiteBalanceRed        : 0
[MakerNotes:CanonCustom:Camera] AFAssistBeam    : Does not emit
[MakerNotes:CanonCustom:Camera] AddOriginalDecisionData: Off
[MakerNotes:CanonCustom:Camera] ExposureLevelIncrements: 1/3 Stop
[MakerNotes:CanonCustom:Camera] FlashSyncSpeedAv: 1/200 Fixed
[MakerNotes:CanonCustom:Camera] HighISONoiseReduction: Off
[MakerNotes:CanonCustom:Camera] HighlightTonePriority: Disable
[MakerNotes:CanonCustom:Camera] ISOExpansion    : On
[MakerNotes:CanonCustom:Camera] LCDDisplayAtPowerOn: Retain power off status
[MakerNotes:CanonCustom:Camera] LongExposureNoiseReduction: Off
[MakerNotes:CanonCustom:Camera] MirrorLockup    : Disable
[MakerNotes:CanonCustom:Camera] SetButtonWhenShooting: Menu display
[MakerNotes:CanonCustom:Camera] Shutter-AELock  : AF/AE lock
[EXIF:InteropIFD:Image] InteropIndex            : R98 - DCF basic file (sRGB)
[EXIF:InteropIFD:Image] InteropVersion          : 0100
[EXIF:IFD1:Image] ThumbnailLength               : 2496
[EXIF:IFD1:Image] ThumbnailOffset               : 55048

Can you fix it?
Title: Re: Broken markup of output if several groups
Post by: Phil Harvey on July 26, 2022, 09:35:13 PM
I don't understand what you mean by "broken markup of output".

Is the problem that the columns no longer align properly?  If so, this isn't something that I think is worthwhile fixing.   

If you want nicely formatted output when some group names are really long, maybe try the -h option and view the results in a web browser.

- Phil
Title: Re: Broken markup of output if several groups
Post by: Jom on July 27, 2022, 02:30:48 AM
Yes, I mean "columns no longer align properly".
I use plain text output, html-tags are not needed.
After all, it's very uncomfortable to watch.
Constantly switching to the browser is also inconvenient, I want to do everything in one console window.
Why do you think it shouldn't be fixed?
Title: Re: Broken markup of output if several groups
Post by: Phil Harvey on July 27, 2022, 06:17:51 AM
1. I don't want to increase the standard column width because it would be too wide for some displays.

2. Adding an extra loop to generate the group names for all of the tags to determine the longest one before starting the output would add an extra step that would slow down exiftool for everyone, and since you are the only one who has complained about this in 19 years I don't think it would be worth it.

3. The same column-misalignment may happen for some not-so-common very long tag names.  I would have to handle this case as well.

- Phil
Title: Re: Broken markup of output if several groups
Post by: Jom on July 27, 2022, 09:49:22 AM
Of course, additional loops — it will be slow.
Then it is possible to improve the appearance of the HTML variant (-h), make it a complete page with styles. This can be made optional.
The rows will not stick together, the columns will be clearly visible.
What do you think about it?

Example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>IMG_1744.CR2</title>
    <style>
        body {font-family: monospace; font-size: 1.2em;}
        table {margin: 0 auto;}
        thead {font-size: 1.6em; font-weight: bold;}
        thead td {padding: 16px 8px;}
        td {padding: 0 8px;}
    </style>
</head>
<body>
<table>
    <thead>
        <tr><td colspan="3">IMG_1744.CR2</td><td></td><td></td></tr>
    </thead>
    <tbody>
        <tr><td>ExifTool</td><td>ExifToolVersion</td><td>12.44</td></tr>
        <tr><td>MakerNotes:Canon:Image</td><td>WBBracketValueAB</td><td>0</td></tr>
        <tr><td>MakerNotes:Canon:Image</td><td>WBBracketValueGM</td><td>0</td></tr>
        <tr><td>MakerNotes:Canon:Image</td><td>WBShiftAB</td><td>0</td></tr>
        <tr><td>MakerNotes:Canon:Image</td><td>WBShiftGM</td><td>0</td></tr>
        <tr><td>MakerNotes:Canon:Image</td><td>WhiteBalance</td><td>Daylight</td></tr>
        <tr><td>MakerNotes:Canon:Image</td><td>WhiteBalanceBlue</td><td>0</td></tr>
        <tr><td>MakerNotes:Canon:Image</td><td>WhiteBalanceRed</td><td>0</td></tr>
        <tr><td>MakerNotes:CanonCustom:Camera</td><td>AFAssistBeam</td><td>Does not emit</td></tr>
        <tr><td>MakerNotes:CanonCustom:Camera</td><td>AddOriginalDecisionData</td><td>Off</td></tr>
        <tr><td>MakerNotes:CanonCustom:Camera</td><td>ExposureLevelIncrements</td><td>1/3 Stop</td></tr>
        <tr><td>MakerNotes:CanonCustom:Camera</td><td>FlashSyncSpeedAv</td><td>1/200 Fixed</td></tr>
        <tr><td>MakerNotes:CanonCustom:Camera</td><td>HighISONoiseReduction</td><td>Off</td></tr>
        <tr><td>MakerNotes:CanonCustom:Camera</td><td>HighlightTonePriority</td><td>Disable</td></tr>
        <tr><td>MakerNotes:CanonCustom:Camera</td><td>ISOExpansion</td><td>On</td></tr>
        <tr><td>MakerNotes:CanonCustom:Camera</td><td>LCDDisplayAtPowerOn</td><td>Retain power off status</td></tr>
        <tr><td>MakerNotes:CanonCustom:Camera</td><td>LongExposureNoiseReduction</td><td>Off</td></tr>
        <tr><td>MakerNotes:CanonCustom:Camera</td><td>MirrorLockup</td><td>Disable</td></tr>
        <tr><td>MakerNotes:CanonCustom:Camera</td><td>SetButtonWhenShooting</td><td>Menu display</td></tr>
        <tr><td>MakerNotes:CanonCustom:Camera</td><td>Shutter-AELock</td><td>AF/AE lock</td></tr>
        <tr><td>EXIF:InteropIFD:Image</td><td>InteropIndex</td><td>R98 - DCF basic file (sRGB)</td></tr>
        <tr><td>EXIF:InteropIFD:Image</td><td>InteropVersion</td><td>0100</td></tr>
        <tr><td>EXIF:IFD1:Image</td><td>ThumbnailLength</td><td>2496</td></tr>
        <tr><td>EXIF:IFD1:Image</td><td>ThumbnailOffset</td><td>55048</td></tr>
        <tr><td>EXIF:IFD2:Image</td><td>BitsPerSample</td><td>16 16 16</td></tr>
        <tr><td>EXIF:IFD2:Image</td><td>Compression</td><td>Uncompressed</td></tr>
    </tbody>
</table>
</body>
</html>
Title: Re: Broken markup of output if several groups
Post by: Phil Harvey on July 27, 2022, 08:52:37 PM
You are free to provide any stylesheet you want (and of course the necessary HTML wrapper elements).  ExifTool just outputs a basic table -- it is up to you to pretty it up however you like.

- Phil
Title: Re: Broken markup of output if several groups
Post by: Jom on July 28, 2022, 10:55:19 AM
OK, I understand.
Then I suggest only to improve the table by adding thead and tbody tags.

<table>
    <thead>
        <tr><td colspan="3">FILE_NAME_OUTPUT</td><td></td><td></td></tr>
    </thead>
    <tbody>
        <tr><td>EXIFTOOL_OUTPUT</td><td>EXIFTOOL_OUTPUT</td><td>EXIFTOOL_OUTPUT</td></tr>
    </tbody>
</table>


In this case, the table will fully comply with the HTML standard and will be suitable for full-fledged design.
Title: Re: Broken markup of output if several groups
Post by: Phil Harvey on July 28, 2022, 11:30:31 AM
Again, this may be done in post-processing.  I hesitate to change the format of this output now since it would break all applications developed over the last 19 years which use this option.

- Phil
Title: Re: Broken markup of output if several groups
Post by: Jom on July 28, 2022, 12:00:16 PM
No, I'm not suggesting breaking anything, I suggest optionally making a full-fledged version of the table, which will not need to be parsed to change, especially on many files. Think about it, maybe people, especially developers, will like a ready-made full-fledged table, with which they will not have to mess around additionally.
I don't insist if there are obstacles, I just clarified my offer.
Title: Re: Broken markup of output if several groups
Post by: Phil Harvey on July 28, 2022, 01:02:16 PM
People using this feature could have already implemented their full-featured table by doing a simple search-and-replace (eg. using 'sed').  A change like this could easily break their output html.

- Phil
Title: Re: Broken markup of output if several groups
Post by: Jom on July 28, 2022, 01:23:23 PM
Phil, you don't understand me.  :)
I'm not suggesting changing the existing -h option, I'm suggesting adding another one with a full-fledged table layout e.g. -h5 (HTML5).
Title: Re: Broken markup of output if several groups
Post by: Phil Harvey on July 28, 2022, 01:27:17 PM
Well, why didn't you say that?

This is a possibility.

- Phil
Title: Re: Broken markup of output if several groups
Post by: Jom on July 28, 2022, 01:48:38 PM
It's all the difficulties of the language barrier, I'm sitting half with a translator.

I'm going to clarify the markup again and write you my own variant to offer. Come up with a name for the option yourself, as you think is correct.

Now will not need to parse anything, just put it in the wrapper of an HTML document.
Title: Re: Broken markup of output if several groups
Post by: Jom on July 28, 2022, 03:10:14 PM
Here's my suggestion.
I have moved the table name to <caption> so that there is more flexibility in the design of each type of element separately.

<table>
    <caption>FILE_NAME</caption>
    <thead>
    <tr>
        <th>GROUPS_COL_NAME</th>
        <th>TAGS_COL_NAME</th>
        <th>VALUES_COL_NAME</th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td>GROUP_NAME:GROUP_NAME</td>
        <td>TAG_NAME</td>
        <td>TAG_VALUE</td>
    </tr>
    <tr>
        <td>GROUP_NAME:GROUP_NAME</td>
        <td>TAG_NAME</td>
        <td>TAG_VALUE</td>
    </tr>
    </tbody>
    <tfoot>
    <tr>
        <td colspan="3">Powered by <a href="https://exiftool.org" target="_blank">ExifTool</a>.</td>
    </tr>
    </tfoot>
</table>
Title: Re: Broken markup of output if several groups
Post by: Jom on July 29, 2022, 10:46:19 AM
Probably, you can also think about enriching the markup with attributes. such as accessibility and others, so that the table is sufficiently fully ready for publication.? So that then for many years everything was enough...