Project

General

Profile

Adobe string left in TIFF

Added by Lars-Daniel Weber about 5 years ago

Anyone with an idea, how to get rid of the last "ADOBE" string in this file? Open it with a hex-editor please :)

test.tif (862 Bytes) test.tif

Replies (9)

RE: Adobe string left in TIFF - Added by Robin Mills about 5 years ago

I don't know what that is and you haven't said why you want it removed. Here's what I can see:

589 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pR ~/Downloads/test.tif 
STRUCTURE OF TIFF FILE (II): /Users/rmills/Downloads/test.tif
 address |    tag                           |      type |    count |    offset | value
      10 | 0x00fe NewSubfileType            |      LONG |        1 |         0 | 0
      22 | 0x0100 ImageWidth                |     SHORT |        1 |         1 | 1
      34 | 0x0101 ImageLength               |     SHORT |        1 |         1 | 1
      46 | 0x0102 BitsPerSample             |     SHORT |        3 |       218 | 8 8 8
      58 | 0x0103 Compression               |     SHORT |        1 |         7 | 7
      70 | 0x0106 PhotometricInterpretation |     SHORT |        1 |         6 | 6
      82 | 0x0111 StripOffsets              |      LONG |        1 |       798 | 798
      94 | 0x0115 SamplesPerPixel           |     SHORT |        1 |         3 | 3
     106 | 0x0116 RowsPerStrip              |     SHORT |        1 |         1 | 1
     118 | 0x0117 StripByteCounts           |      LONG |        1 |        63 | 63
     130 | 0x011a XResolution               |  RATIONAL |        1 |       224 | 224/0
     142 | 0x011b YResolution               |  RATIONAL |        1 |       232 | 232/0
     154 | 0x011c PlanarConfiguration       |     SHORT |        1 |         1 | 1
     166 | 0x0128 ResolutionUnit            |     SHORT |        1 |         2 | 2
     178 | 0x015b JPEGTables                | UNDEFINED |      558 |       240 | ................................ ...
     190 | 0x0212 YCbCrSubSampling          |     SHORT |        2 |     65537 | 1 1
     202 | 0x0213 YCbCrPositioning          |     SHORT |        1 |         2 | 2
END /Users/rmills/Downloads/test.tif
590 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pC ~/Downloads/test.tif 
591 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pX ~/Downloads/test.tif 
592 rmills@rmillsmbp:~/gnu/exiv2/trunk $ 
I suspect it's in the tag 'JPEG tables'. Looking with my old (home made) dumper dmpf.cpp, I see:
594 rmills@rmillsmbp:~/gnu/exiv2/trunk $ dmpf ~/Downloads/test.tif 
     0      0: II*.............  ->   I  I  * 00 08 00 00 00 11 00 fe 00 04 00 01 00
  0x10     16: ................  ->  00 00 00 00 00 00 00 01 03 00 01 00 00 00 01 00
  0x20     32: ................  ->  00 00 01 01 03 00 01 00 00 00 01 00 00 00 02 01
  0x30     48: ................  ->  03 00 03 00 00 00 da 00 00 00 03 01 03 00 01 00
  0x40     64: ................  ->  00 00 07 00 00 00 06 01 03 00 01 00 00 00 06 00
  0x50     80: ................  ->  00 00 11 01 04 00 01 00 00 00 1e 03 00 00 15 01
  0x60     96: ................  ->  03 00 01 00 00 00 03 00 00 00 16 01 03 00 01 00
  0x70    112: ..............?.  ->  00 00 01 00 00 00 17 01 04 00 01 00 00 00  ? 00
  0x80    128: ................  ->  00 00 1a 01 05 00 01 00 00 00 e0 00 00 00 1b 01
  0x90    144: ................  ->  05 00 01 00 00 00 e8 00 00 00 1c 01 03 00 01 00
  0xa0    160: ......(.........  ->  00 00 01 00 00 00  ( 01 03 00 01 00 00 00 02 00
  0xb0    176: ..[.............  ->  00 00  [ 01 07 00 2e 02 00 00 f0 00 00 00 12 02
  0xc0    192: ................  ->  03 00 02 00 00 00 01 00 01 00 13 02 03 00 01 00
  0xd0    208: ................  ->  00 00 02 00 00 00 00 00 00 00 08 00 08 00 08 00
  0xe0    224: .....'.......'..  ->  f0 ef 10 00 10  ' 00 00 f0 ef 10 00 10  ' 00 00
  0xf0    240: ................  ->  ff d8 ff db 00 84 00 02 02 02 02 02 02 02 02 02
 0x100    256: ................  ->  02 03 02 02 02 03 04 03 02 02 03 04 05 04 04 04
 0x110    272: ................  ->  04 04 05 06 05 05 05 05 05 05 06 06 07 07 08 07
 0x120    288: ................  ->  07 06 09 09 0a 0a 09 09 0c 0c 0c 0c 0c 0c 0c 0c
 0x130    304: ................  ->  0c 0c 0c 0c 0c 0c 0c 01 03 03 03 05 04 05 09 06
 0x140    320: ................  ->  06 09 0d 0a 09 0a 0d 0f 0e 0e 0e 0e 0f 0f 0c 0c
 0x150    336: ................  ->  0c 0c 0c 0f 0f 0c 0c 0c 0c 0c 0c 0f 0c 0c 0c 0c
 0x160    352: ................  ->  0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c
 0x170    368: ................  ->  0c 0c 0c 0c 0c 0c 0c 0c ff c4 01 a2 00 00 00 07
 0x180    384: ................  ->  01 01 01 01 01 00 00 00 00 00 00 00 00 04 05 03
 0x190    400: ................  ->  02 06 01 00 07 08 09 0a 0b 01 00 02 02 03 01 01
 0x1a0    416: ................  ->  01 01 01 00 00 00 00 00 00 00 01 00 02 03 04 05
 0x1b0    432: ................  ->  06 07 08 09 0a 0b 10 00 02 01 03 03 02 04 02 06
 0x1c0    448: ......s.......!.  ->  07 03 04 02 06 02  s 01 02 03 11 04 00 05  ! 12
 0x1d0    464: 1AQ..a"q..2.....  ->   1  A  Q 06 13  a  "  q 81 14  2 91 a1 07 15 b1
 0x1e0    480: B#.R..3.b.$r..%C  ->   B  # c1  R d1 e1  3 16  b f0  $  r 82 f1  %  C
 0x1f0    496: 4S...cs.5D'...6.  ->   4  S 92 a2 b2  c  s c2  5  D  ' 93 a3 b3  6 17
 0x200    512: Tdt....&.......E  ->   T  d  t c3 d2 e2 08  & 83 09 0a 18 19 84 94  E
 0x210    528: F..V.U(........e  ->   F a4 b4  V d3  U  ( 1a f2 e3 f3 c4 d4 e4 f4  e
 0x220    544: u........fv.....  ->   u 85 95 a5 b5 c5 d5 e5 f5  f  v 86 96 a6 b6 c6
 0x230    560: ...7GWgw........  ->  d6 e6 f6  7  G  W  g  w 87 97 a7 b7 c7 d7 e7 f7
 0x240    576: 8HXhx........)9I  ->   8  H  X  h  x 88 98 a8 b8 c8 d8 e8 f8  )  9  I
 0x250    592: Yiy........*:JZj  ->   Y  i  y 89 99 a9 b9 c9 d9 e9 f9  *  :  J  Z  j
 0x260    608: z...............  ->   z 8a 9a aa ba ca da ea fa 11 00 02 02 01 02 03
 0x270    624: .........m......  ->  05 05 04 05 06 04 08 03 03  m 01 00 02 11 03 04
 0x280    640: !.1A.Q.a".q..2..  ->   ! 12  1  A 05  Q 13  a  " 06  q 81 91  2 a1 b1
 0x290    656: .....#B.Rbr.3$4C  ->  f0 14 c1 d1 e1  #  B 15  R  b  r f1  3  $  4  C
 0x2a0    672: ...S%.c...s.5.D.  ->  82 16 92  S  % a2  c b2 c2 07  s d2  5 e2  D 83
 0x2b0    688: .T......&6E.'dtU  ->  17  T 93 08 09 0a 18 19  &  6  E 1a  '  d  t  U
 0x2c0    704: 7....().........  ->   7 f2 a3 b3 c3  (  ) d3 e3 f3 84 94 a4 b4 c4 d4
 0x2d0    720: ..eu........FVfv  ->  e4 f4  e  u 85 95 a5 b5 c5 d5 e5 f5  F  V  f  v
 0x2e0    736: ........GWgw....  ->  86 96 a6 b6 c6 d6 e6 f6  G  W  g  w 87 97 a7 b7
 0x2f0    752: ....8HXhx.......  ->  c7 d7 e7 f7  8  H  X  h  x 88 98 a8 b8 c8 d8 e8
 0x300    768: .9IYiy........*:  ->  f8  9  I  Y  i  y 89 99 a9 b9 c9 d9 e9 f9  *  :
 0x310    784: JZjz............  ->   J  Z  j  z 8a 9a aa ba ca da ea fa ff d9 ff d8
 0x320    800: ....Adobe.d@....  ->  ff ee 00 0e  A  d  o  b  e 00  d  @ 00 00 00 01
 0x330    816: ................  ->  ff c0 00 11 08 00 01 00 01 03 01 11 00 02 11 01
 0x340    832: ................  ->  03 11 01 ff dd 00 04 00 01 ff da 00 0c 03 01 00
 0x350    848: .....?........    ->  02 11 03 11 00  ? 00 fb f9 8a bf ff d9 00
595 rmills@rmillsmbp:~/gnu/exiv2/trunk $ 
You can't modify JPEGTables because it's protected by isTiffImageTag(). Here's the code for dmpf.cpp which was inspired by a utility on the Apollo Computer. I've been carrying my home made version about in my hip-pocket for about 25 years:
#include <stdio.h>
#include <string.h>

static enum
{   errorOK = 0
,   errorSyntax 
,   errorProcessing
}   error = errorOK ;

void syntax()
{
    printf("syntax: dmpf [-option]+ filename\n") ;
}

bool printable(unsigned char c) { return c >= 32 && c <= 127 && c != '.' ; } 

int main(int argc, char* argv[])
{
    char* filename = argv[1] ;
    FILE* f = NULL ;

    if ( argc < 2 ) {
        syntax() ;
        error = errorSyntax ;
    }

    if ( !error ) {
        f = strcmp(filename,"-") ? fopen(filename,"rb") : stdin ;
        if ( !f ) {
            printf("unable to open file %s\n",filename) ;
            error = errorProcessing ;
        }
    }

    if ( !error  )
    {
        char line[1000] ;
        char buff[16]   ;
        int  n          ;
        int count = 0   ;
        while ( (n = fread(buff,1,sizeof buff,f)) > 0 )
        {
            // line number
            int l = sprintf(line,"%#6x %6d: ",count,count ) ;
            count += n ;

            // ascii print
            for ( int i = 0 ; i < n ; i++ )
            {
                char c = buff[i] ;
                l += sprintf(line+l,"%c", printable(c) ? c : '.' ) ;
            }
            // blank pad the ascii
            int save = n ;
            while ( n++ < sizeof(buff) ) l += sprintf(line+l," ") ;
            n = save     ;

            // hex code
            l += sprintf(line+l,"  -> ") ;
            for ( int i = 0 ; i < n ; i++ )
            {
                unsigned char c = buff[i] ;
                l += sprintf(line+l,printable(c) ? "  %c" : " %02x" ,c) ;
            }

            line[l] = 0 ;
            printf("%s\n",line) ;
        }
    }

    return error ;
}

RE: Adobe string left in TIFF - Added by Lars-Daniel Weber about 5 years ago

Robin Mills wrote:

You can't modify JPEGTables because it's protected by isTiffImageTag().

So it's a missing feature?

RE: Adobe string left in TIFF - Added by Robin Mills about 5 years ago

No. It's designed to be this way. I don't know what JPEGTables are, however they are not something you should be changing.

You haven't explained why you want to remove the 'adobe' stuff.

RE: Adobe string left in TIFF - Added by Robin Mills about 5 years ago

Here's some information about JPEGTables. http://www.awaresystems.be/imaging/tiff/tifftags/jpegtables.html

For sure, this doesn't sound like something you should be trying to modify. If it has the string 'adobe' embedded, this data has probably been encoded according to a standard defined by Adobe. Changing anything in that tag will probably change the appearance of the image and could seriously corrupt the image.

I believe "quantisation" is about with providing a pixel colour lookup table. If the image uses a small number of different colours, you can "palletise" the image. So instead of storing the colour of every pixel in the framebuffer, you store a pixel index. For an RGB image with 8bits of RGB (24 bits/pixel), if less than 256 colours are in use, you only need to store 1 byte (the index) in every pixel.

Here's more information about Huffman Coding: https://en.wikibooks.org/wiki/JPEG_-_Idea_and_Practice/The_Huffman_coding

RE: Adobe string left in TIFF - Added by Robin Mills about 5 years ago

I've looked a little more carefully at your file. I think that 'Adobe' stuff is something tucked onto the end of the file and not referenced by the TIFF/Directory structure! Looking at the output from $ exiv2 -pR test.tiff the JPEGTable data is located in bytes 240 to 798. Inspecting the output from dmpf, shows the 'Adobe' string starts at byte 804.

I don't know what that data means. It looks suspiciously like an JPEG/APPn segment or something. I chopped it off the file with dd:

$ dd bs=1 skip=0 count=804 if=~/Downloads/test.tif of=x.tif

RE: Adobe string left in TIFF - Added by Lars-Daniel Weber about 5 years ago

Robin Mills wrote:

You haven't explained why you want to remove the 'adobe' stuff.

I thought, it'd be some kind of metadata, which hasn't been recognized by exiv2. I'll have a look at other TIFFs, which I've created with other tools and report again.

RE: Adobe string left in TIFF - Added by Robin Mills about 5 years ago

I wouldn't be demotivated to help you if you bothered to say "Thank You" for the time I have given to you.

RE: Adobe string left in TIFF - Added by Lars-Daniel Weber about 5 years ago

Oh, from my side, this discussion wasn't closed. I wanted to say "thank you" at the end ... but of course: THANK YOU for the time spent.

RE: Adobe string left in TIFF - Added by Robin Mills about 5 years ago

Thanks. I will work to get ICC support finished this week (and the stdin/stdout feature). The last two weeks have been unbelievably busy on Redmine and the Forum (12 hour days).

    (1-9/9)