Tk Library Source Code

View Ticket
Login
Ticket UUID: 1381659
Title: jpeg::removeComments destroys jpeg files completely
Type: Bug Version: None
Submitter: vbwagner Created on: 2005-12-15 14:05:26
Subsystem: jpeg Assigned To: afaupell
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2005-12-22 20:19:23
Resolution: None Closed By: afaupell
    Closed on: 2005-12-15 17:06:44
Description:
When tcllib jpeg package used with [encoding system]
other than iso8859-1, procedures jpeg::removeComments
and jpeg::replaceComments (which calls former one)
convert jpeg file into piece of junk, replacing all
8-bit symbols by question marks.

Problem is that jpeg::openJFIF routine opens binary
file properly, setting -translation binary, but
jpeg::removeComments opens file in write mode to
overwrite its content there, and doesn't configure it
as binary. So, binary data read from original file are
"converted" to [encoding system], which result in
replacing all 8-bit symbols with "unknown character"
marker.

Solution is to add

fconfigure $fh -translation binary 

into jpeg::removeComments routine just after 

set fh [open $file w]
User Comments: vbwagner added on 2005-12-22 20:19:23:
Logged In: YES 
user_id=757679

Please increase the version number of the package after this
change.

If package would have version 0.3, scripts which need
working removeComments/removeExif may

package require jpeg 0.3

and fail immediately if user have buggy version of package
instead of destroying user images.

It is that very kind of changes which should be reflected in
the minor version number, because it is even more than new
functionality added - functionality which was destructive
for user data, became useful.

afaupell added on 2005-12-16 00:06:44:
Logged In: YES 
user_id=812825

thanks for pointing out my mistake. I fixed this problem in
removeComments and also in removeExif