Is it possible to remove the tiff:document property?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
djones
Posts: 6
Joined: 2014-02-22T11:51:29-07:00
Authentication code: 6789

Is it possible to remove the tiff:document property?

Post by djones »

Hello to all, first time poster here.

Versions of ImageMagick used:

Windows: ImageMagick 6.8.7-0-Q8-x64-dll
Windows: ImageMagick 6.8.8-7-Q16-x86-dll
Linux: ImageMagick 6.7.8-8 2013-03-18 Q16

I have been searching the forums and found one reference to my problem:

viewtopic.php?f=1&t=15244&hilit=tiff%3Adocument

It was solved by using +set tiff:document and +set tiff:rows-per-strip but for me it does not work.

As an example, I want to create a blank image using this:

Code: Select all

convert -size 100x100 xc:white -units PixelsPerInch +set tiff:document -define tiff:rows-per-strip=100 -density 400 -depth 8 ^
-type Bilevel -colorspace Gray -compress None c:\im\out\image.tif
If i issue:

Code: Select all

identify -verbose c:\im\out\image.tif
I get:

Code: Select all

  Properties:
    date:create: 2014-02-21T20:09:45-05:00
    date:modify: 2014-02-21T20:25:47-05:00
    signature: f97b03c5734e97166dfea3f40b8d4a9bc165e5111065d1dc848ec6332d10c9b1
    tiff:document: c:\im\out\image.tif
    tiff:endian: lsb
    tiff:photometric: min-is-black
    tiff:rows-per-strip: 4
  Artifacts:
    filename: image.tif
    verbose: true


I need to remove the tiff:document property or at the minimum the path.

The output name given was just an example but in actual fact, I generate a list of the tiff files to be
processed and the filenames are used as the output filenames and sent into another folder.

ex.:
input files
c:\im\in\image1.tif
c:\im\in\image2.tif
etc.

output files
c:\im\out\image1.tif
c:\im\out\image2.tif
etc.

Is there any hope?

Dennis.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Is it possible to remove the tiff:document property?

Post by snibgo »

I suppose the property is only added when the file is written. You could remove it with exiftool.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Is it possible to remove the tiff:document property?

Post by fmw42 »

I have not tested this, but does it not go away when you use -strip?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Is it possible to remove the tiff:document property?

Post by magick »

Fixed in ImageMagick 6.8.8-8 Beta available by sometime tomorrow.
djones
Posts: 6
Joined: 2014-02-22T11:51:29-07:00
Authentication code: 6789

Re: Is it possible to remove the tiff:document property?

Post by djones »

Removing the property with an external tool works but i wanted to avoid that.
It's not really practical when you have tens of thousand images. Not counting
the ones that were sent to clients (over 1 million), some don't care but others do.
That's how i discovered that "feature" :shock:

The -strip option did not do anything, that's why i asked.

I was looking at the -define option and saw that tiff:document was not in the list
of properties anymore, and decided to play with +set. Obviously, that did not
work either.

I must say that you can change tiff:document property as you like, as long as you don't
write to and image...

See: http://www.imagemagick.org/Usage/basics/#set

If you use:

Code: Select all

convert rose: -set tiff:document my_property -verbose info:
You get:

Code: Select all

 Properties:
    date:create: 2014-02-23T01:05:26-05:00
    date:modify: 2014-02-23T01:05:26-05:00
    signature: a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7
    tiff:document: my_property
  Artifacts:
    filename: rose:
    verbose: true
I see that the filename is rose: instead of rose, is this normal?

Finally, thanks to magick for a super fast update. I really appreciate.

And just to make sure, this command will now work as expected?

Code: Select all

    convert -size 100x100 xc:white -units PixelsPerInch +set tiff:document -define tiff:rows-per-strip=100 -density 400 -depth 8 ^
    -type Bilevel -colorspace Gray -compress None c:\im\out\image.tif
And what about +define tiff:document, will it also work?

I'll report back when i get the new version and have a chance to test it.

Thank you.

Dennis.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Is it possible to remove the tiff:document property?

Post by dlemstra »

The next version of ImageMagick will only write tiff:document when you explicitly add it yourself:

Code: Select all

convert -size 100x100 xc:white -units PixelsPerInch -define tiff:document=Dennis -define tiff:rows-per-strip=100 -density 400 -depth 8 ^
-type Bilevel -colorspace Gray -compress None c:\im\out\image.tif

Code: Select all

  Properties:
    date:create: 2014-02-23T09:18:12+01:00
    date:modify: 2014-02-23T09:18:12+01:00
    signature: 1977958db19dc7cb8a327c98f8d3c0f338feda83395563ba18d6285ab98cd1c2
    tiff:document: Dennis
    tiff:endian: lsb
    tiff:photometric: min-is-black
    tiff:rows-per-strip: 81
  Artifacts:
    filename: c:\im\out\image.tif
    verbose: true
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Is it possible to remove the tiff:document property?

Post by fmw42 »

rose: ( with : ) is an internal IM stored image. See http://www.imagemagick.org/script/forma ... tin-images

I do not believe there is any +define. The only way to remove meta data at this time is -strip and +profile.

Generally to remove the values stored in a meta data field, you just set it to an empty string. That does not alway remove the field altogether. It usually just empties the field, though I have not tested this recently. At least that is the way it works for -set comment.
djones
Posts: 6
Joined: 2014-02-22T11:51:29-07:00
Authentication code: 6789

Re: Is it possible to remove the tiff:document property?

Post by djones »

rose: ( with : ) is an internal IM stored image.
I know, but i forgot that I was not actually writing the image. If you do,
you get the actual filename. My bad.
I do not believe there is any +define.
What about:
http://www.imagemagick.org/script/comma ... php#define
Use +define key to remove definitions previously created. Use +define "*" to remove all existing definitions.
I thought it was related to the removal of properties inside the file, I guess I assumed wrong?

Believe me, I've tried everything, +/- set/define empty/not empty, I even tried some combinations from
http://www.imagemagick.org/script/escape.php and nothing worked! :?

Thank you all for your input.

Dennis.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Is it possible to remove the tiff:document property?

Post by snibgo »

Confirmed that

Code: Select all

convert r.tiff +define * r2.tiff
doesn't work (v6.8.8-7 on Windows 8.1). Either the documentaion http://www.imagemagick.org/script/comma ... php#define or software is wrong.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Is it possible to remove the tiff:document property?

Post by fmw42 »

Use +define key to remove definitions previously created. Use +define "*" to remove all existing definitions.
I did not know about that. I learned something new, today!

But I am not sure that is relevant, I think you need +set key. At least that works for me for example for

Code: Select all

convert rose: -set comment "testing" rose1.png

identify -verbose rose1.png 

Properties:
comment: testing

Code: Select all

convert rose1.png +set comment rose2.png

identify -verbose rose2.png

has the comment: property totally remove.

If that does not work for your situation, then report on Bugs forum and see what the developers have to say.
djones
Posts: 6
Joined: 2014-02-22T11:51:29-07:00
Authentication code: 6789

Re: Is it possible to remove the tiff:document property?

Post by djones »

I can confirm that using -set comment "something" works. As well as +set comment.

What does not works is everything related to any of the tiff: properties.

If you use

Code: Select all

convert -size 100x100 xc:white -units PixelsPerInch -define tiff:rows-per-strip=100 -density 400 -depth 8 ^
        -type Bilevel -colorspace Gray -compress None outfile.tif
You get

Code: Select all

  Properties:
    date:create: 2014-02-23T17:16:12-05:00
    date:modify: 2014-02-23T17:16:12-05:00
    signature: 1977958db19dc7cb8a327c98f8d3c0f338feda83395563ba18d6285ab98cd1c2
    tiff:document: outfile.tif
    tiff:endian: lsb
    tiff:photometric: min-is-black
    tiff:rows-per-strip: 81
  Artifacts:
    filename: outfile.tif
    verbose: true
Since I did not sent the image into another folder, you get the filename only.

You will notice that the rows-per-strip did not change. But I can confirm that opening the file with a program
that can read the number of tiles gives 100. If I don't change the number of rows-per-strip, I get 81.

And it does'nt matter if I use -set or -define the results are the same.

Without using -define tiff:rows-per-strip..., I get:

Tiles
Number: 2
Width (pixels): 100
Length (pixels): 81

If I use -define tiff:rows-per-strip=100, I get:

Tiles
Number: 1
Width (pixels): 100
Length (pixels): 100

But still, identify reports 81.

Dennis.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Is it possible to remove the tiff:document property?

Post by fmw42 »

Are you using IM 6888 beta?
djones
Posts: 6
Joined: 2014-02-22T11:51:29-07:00
Authentication code: 6789

Re: Is it possible to remove the tiff:document property?

Post by djones »

Oops! was not...

Version used: ImageMagick-6.8.8-8~beta20140222.zip and ImageMagick-6.8.8-8.tar.bz2 just in case they were different?

After compiling under linux

Code: Select all

/usr/local/bin/convert -version
Version: ImageMagick 6.8.8-8 Q16 x86_64 2014-02-23 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: fftw fontconfig freetype jng jpeg lcms lzma pangocairo png tiff x xml zlib
I can confirm that the tiff:document property is NOT written inside the file.

The rows-per-strip property is still wrong though.

Any chance for a windows build? That's what I have to use.

Thank you.

Dennis.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Is it possible to remove the tiff:document property?

Post by fmw42 »

I can confirm that neither of these work correctly on IM 6.8.8.8 beta Mac OSX Snow Leopard


im6888beta convert -size 100x100 xc:white -units PixelsPerInch -define tiff:rows-per-strip=100 -density 400 -depth 8 -type Bilevel -colorspace Gray -compress None outfile.tif

identify outfile.tif
Image: outfile.tif
Properties:
date:create: 2014-02-23T16:57:04-08:00
date:modify: 2014-02-23T16:57:04-08:00
signature: 1977958db19dc7cb8a327c98f8d3c0f338feda83395563ba18d6285ab98cd1c2
tiff:document: outfile.tif
tiff:endian: lsb
tiff:photometric: min-is-black
tiff:rows-per-strip: 81

It is showing 81 rather than the requested 100


Then

im6888beta convert outfile.tif +define tiff:rows-per-strip outfile2.tif
convert: no such option `tiff:rows-per-strip' @ error/convert.c/ConvertImageCommand/1183.

and

im6888beta convert outfile.tif +define "*" outfile2.tif

convert: no such option `*' @ error/convert.c/ConvertImageCommand/1183.

But the docs on the options page show:

Use +define "*" to remove all existing definitions.
djones
Posts: 6
Joined: 2014-02-22T11:51:29-07:00
Authentication code: 6789

Re: Is it possible to remove the tiff:document property?

Post by djones »

There might be a reason for it, rows-per-strip is a required field.

See:
http://partners.adobe.com/public/develo ... .html#spec

You can also have a look under coders/tiff.c (source file)

Using:

Code: Select all

#!/bin/bash

convert -size 100x100 xc:white -units PixelsPerInch \
        -set tiff:artist "my_Artist [315]" \
        -set tiff:copyright "my_Copyright [33432]" \
        -set tiff:document "my_DocumentName [269]" \
        -set tiff:hostcomputer "my_HostComputer [316]" \
        -set tiff:make "my_Make [271]" \
        -set tiff:model "my_Model [272]" \
        -set tiff:software "my_Software [305]" \
        -set tiff:timestamp "2014-02-24 19:00:00" \
        -density 400 -depth 8 -type Bilevel -colorspace Gray -compress None image_tifftags.tif
#tiff:timestamp = DateTime [306] \

Note: The numbers in [] represents the actual decimal value of the tag.

You will see that the tags are all there if you use identify -verbose or tiffdump.

There are more, but I did not tried them.

You will notice that rows-per-strip is not there. It is written/calculated when you actually send the output to a file.

By using -define tiff:rows-per-strip, you're only "masking" the actual value, that's why, when
you use identify -verbose, you get the "true" value.

At least, that's how I understand it.

Can anyone confirm this?

Dennis.
Post Reply