[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: exif --remove not idempotent, and a Debian man page bug



On Fri 23 Sep 2022 at 16:14:43 (+0200), Emanuel Berg wrote:
> David Wright wrote:
> >> exif(1) which says on line 57 that --remove
> >> 
> >>   Remove the tag or (if no tag is specified) the entire IFD.
> >> 
> >> Only if it does, why is it there the next time to be removed
> >> as well?
> >
> > Have you tried it?
> 
> Yes, see the first post runs, they show that the same result
> is obtained from running the same supposedly remove command on
> the same files, 1, 2, and it would seem n number of times.

I made an error in my testing, in that I think I used a
(published) stripped jpeg for the same-filename test.

Using a photograph from my own archives shows that --remove
is stripping the IFD and   -o foo foo   is overwriting the
original file, though I don't know what its mechanism is
(one hopes it makes safeguards).

> No, in that case I would have .modified. img files over the
> whole disk.

Yes, that would seem to be correct.

> > It's up to you to overwrite the original.
> 
> You mean don't use the -o, or use the -o to point to a new
> file, and then manually overwrite the old file with the
> new one?

To be honest, I don't use exif but exifprobe -L, and I wouldn't
want to make modifications without keeping modified copies in a
separate tree (I've done this for lower resolution publication
on web pages). I can see why you might be doing the same sort
of thing (perhaps for tree-houses?).

BTW exif can't read photos off a Samsung Gusto2 mobile.

> re: exif I don't know why processing happens again if the
> material has already been removed.

It wouldn't be the first filter program to behave in this way.

> The '-o' shouldn't
> matter since step one should be "is the material present?" and
> if it isn't, nothing should be outputted. It should just say
> "this file is already OK".

That would be asking a filter program to treat the construction
--remove -o foo foo   as a unique case, where it conditionally
doesn't write an output file.

Anyway, here's a test on an old photograph of mine:

$ exif 2005-05-24-18-20-44.jpg
EXIF tags in '2005-05-24-18-20-44.jpg' ('Intel' byte order):
--------------------+----------------------------------------------------------
Tag                 |Value
--------------------+----------------------------------------------------------
Image Description   |000001
Manufacturer        |FUJIFILM
Model               |DS-300
Orientation         |Top-left
X-Resolution        |72
Y-Resolution        |72
Resolution Unit     |Inch
White Point         |0.3127, 0.3290
Primary Chromaticiti|0.640, 0.330, 0.300, 0.600, 0.150, 0.060
YCbCr Coefficients  |0.299, 0.587, 0.114
YCbCr Positioning   |Co-sited
Reference Black/Whit| 0, 255, 128, 255, 128, 255
Exif Version        |Exif Version 1.1
Date and Time (Origi|2005:05:24 18:20:43
Components Configura|Y Cb Cr -
Compressed Bits per | 2
Shutter Speed       |6.50 EV (1/91 sec.)
Aperture            |3.50 EV (f/3.4)
FlashPixVersion     |FlashPix Version 1.0
Color Space         |Uncalibrated
--------------------+----------------------------------------------------------
$ exif --remove -o 2005-05-24-18-20-44.jpg 2005-05-24-18-20-44.jpg
Wrote file '2005-05-24-18-20-44.jpg'.
$ exif 2005-05-24-18-20-44.jpg
EXIF tags in '2005-05-24-18-20-44.jpg' ('Intel' byte order):
--------------------+----------------------------------------------------------
Tag                 |Value
--------------------+----------------------------------------------------------
X-Resolution        |72
Y-Resolution        |72
Resolution Unit     |Inch
Exif Version        |Exif Version 2.1
FlashPixVersion     |FlashPix Version 1.0
Color Space         |Uncalibrated
--------------------+----------------------------------------------------------
$ exif --remove -o 2005-05-24-18-20-44.jpg 2005-05-24-18-20-44.jpg
Wrote file '2005-05-24-18-20-44.jpg'.
$ exif 2005-05-24-18-20-44.jpg
EXIF tags in '2005-05-24-18-20-44.jpg' ('Intel' byte order):
--------------------+----------------------------------------------------------
Tag                 |Value
--------------------+----------------------------------------------------------
X-Resolution        |72
Y-Resolution        |72
Resolution Unit     |Inch
Exif Version        |Exif Version 2.1
FlashPixVersion     |FlashPix Version 1.0
Color Space         |Uncalibrated
--------------------+----------------------------------------------------------
$ 

… idempotent ad infinitum.

Cheers,
David.


Reply to: