Re: tcllib jpeg package and JPEG comments ...



Hi and good morning,

yes, you are right a simple "string map" and a "regsub" and everything
is ok.

That's the way I already deal with the JPEG comments returned from the
jpeg package.

The only problem exists, if an application like IrfanView changes the
first comment chunk using all comment chunks, without deleting the
2,...,n th comment chunk.

How should I interpret the probably doubled comment context?

Or if an application like Exifer uses only the last comment chunk, no
matter how many exist.

So - not knowing which chunk was last edited or had a kind of
"priority" while being edited from an application, I don't know
anything about the comment chunks to be used!

But ... like Larry already wrote ... I should write my own JPEG
comment editor and than I should rely only on this selfmade
application!

Or ... like I did with IrfanView ... I have to write e-mails to the
developers maintaining tools like IrfanView or Exifer (last version
from 2005). And there are many other such EXIF, IPCT, comment editing
utilities.

Best regards,

Martin Lemburg

On May 30, 7:59 pm, aar...@xxxxxxxxx wrote:
There is no limitation on what may appear in a comment chunk. The jpeg
fields are specified by byte length so there isnt even an ending
sequence to be careful of. I think it would be incorrect for the jpeg
module to not return the exact contents of the field, including nulls.

I think your problem could be handled with a simple string map:

set comments [string map {\r\n \n \r \n \x00 ""} [jpeg::getComments
$file]]

it would also be possible to remove all non ascii characters with a
regsub.

On May 30, 4:03 am, "MartinLemburg@UGS" <martin.lemburg....@xxxxxxx>
wrote:

Hello Uwe,

sorry, but I'm on MS Windows XP and have no running X Server to use
the XV for NT.

But I tried to examine what's going on with different applications
able to read/write JPEG comments.

1. using the utility jhead - depending on the data written to the
comment, the comment can contain any of the line end combinations like
\r\n, \n, or \r. jhead only reads and writes the first comment block.

2. using Exifer - Exifer always uses \r\n (like normal on MS Windows)
and reads/modifies only the last comment block

3. using IrfanView - IrfanView uses \r as line end, reads all comment
blocks, but modifies only the first without removing the other blocks
and appends a \0 at the end

So using the jpeg package to read comments is not necessarily the best
not knowing the comment writing application.
While it's no problem to deal with line ends, the problems are raised
by something like the \0 at the comments end or by the existence of
multiple comment blocks, where only one may be is most current -
depending on the software used to write the comments.

Perhabs it is a good enhancement for the jpeg package to deal inside
with the line ends and probably non-printable characters inside the
comments?
Or are binary comments allowed? I don't think so.

Best regards,

Martin Lemburg
----

Uwe Klein wrote:
MartinLemburg@UGS 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?

What platform? unix/cygwin:
you can try with rd|wrjpegcom from the jpeg package
---> http://www.ijg.org/files/
xv can display the comments as well.
--->http://www.trilon.com/xv/

this might be of interest:
http://netzreport.googlepages.com/hidden_data_in_jpeg_files.html

uwe- Hide quoted text -

- Show quoted text -


.



Relevant Pages

  • 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: Is compact flash airport-safe?
    ... > probability event -- there isn't much metadata in a JPEG or even RAW ... > An SEU mid-stream can cause the decoder to lose sync, ... > chunk only effects that chunk, though the visible result is from that ... and FAT-16 is a modern file system? ...
    (rec.photo.digital.slr-systems)
  • 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 ...
    ... 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)
  • Re: Decompressing data that was compressed using JPEG style compression
    ... I have a need to read out data that was compressed using the JPEG ... compression algorithm. ... In your case (just a chunk of dynamic data) do not have this ...
    (microsoft.public.dotnet.languages.csharp)