Re: tcllib jpeg package and JPEG comments ...



The return value of getComments is a list because a jpeg file may have
multiple comment chunks. However most jpeg writers will only write a
single one. The line ending is platform or writer specific. Your use
of single quotes in the examples is confusing the issue somewhat,
single quotes are not special in tcl. 'abc def' is actually a 2
element list as the manual page indicates.

On May 29, 9:06 am, "MartinLemburg@UGS" <martin.lemburg....@xxxxxxx>
wrote:
Hello again,

I went now experimenting the other way, writing comments with the jpeg
package like this:

% package require jpeg
0.3
% puts '[jpeg::getComments $fileName]'
''
% jpeg::addComment $fileName "abc"
% jpeg::addComment $fileName "def"
% puts '[jpeg::getComments $fileName]'
'abc def'

Then I opened the JPEG file with IrfanView, saved the non-changed
comment and reread the comment inside the tcl shell:

% puts '[jpeg::getComments $fileName]'
def } def'
% puts '[string map {"\r" "\n"} [jpeg::getComments $fileName]]'
'{abc
def } def'
% scan [string index [lindex [jpeg::getComments $fileName] 0] end]
%c
0

I know, that IrfanView may handle the comments in a wrong way, but
currently I don't have any other bitmap application allowing to view
or to change the JPEG comments!

Can somebody help?

Thanks and best regards,

Martin

On May 29, 5:46 pm, "MartinLemburg@UGS" <martin.lemburg....@xxxxxxx>
wrote:



Hello,

I used IrfanView to put a comment to a JPEG file and afterwards I used
the tcllib jpeg package to access this comment like this:

% ::jpeg::getComments $fileName
...

I realized, that if the comment has line breaks, the returned comment
contains "\r" (CarriageReturns) instead of newlines.
And at the end of the comment there is an ASCII 0.

Even being confused about the procedure name "getComments" and the
help text:

Returns a list containing all the JPEG comments found in the file.
Throws an error if file is not a valid JPEG image.

I ask myself, if I have really understood this JPEG comment thing.

Can I have more than one? Does the "\r" instead of "\n" and the "\0"
have undocumentated reasons?

Thanks for any thought and hint!

Best regards,

Martin- Hide quoted text -

- Show quoted text -


.



Relevant Pages

  • Re: tcllib jpeg package and JPEG comments ...
    ... I went now experimenting the other way, writing comments with the jpeg ... % package require jpeg ... 'abc def' ... I used IrfanView to put a comment to a JPEG file and afterwards I used ...
    (comp.lang.tcl)
  • Re: tcllib jpeg package and JPEG comments ...
    ... using IrfanView - IrfanView uses \r as line end, ... So using the jpeg package to read comments is not necessarily the best ... 'abc def' ...
    (comp.lang.tcl)
  • Re: tcllib jpeg package and JPEG comments ...
    ... I went now experimenting the other way, writing comments with the jpeg ... % package require jpeg ... 'abc def' ... Then I opened the JPEG file with IrfanView, ...
    (comp.lang.tcl)
  • Re: tcllib jpeg package and JPEG comments ...
    ... That's the way I already deal with the JPEG comments returned from the ... if an application like IrfanView changes the ... 2,...,n th comment chunk. ... 'abc def' ...
    (comp.lang.tcl)
  • Re: tcllib jpeg package and JPEG comments ...
    ... I think it would be incorrect for the jpeg ... using IrfanView - IrfanView uses \r as line end, ... So using the jpeg package to read comments is not necessarily the best ... 'abc def' ...
    (comp.lang.tcl)