Tk Source Code

View Ticket
Login
Ticket UUID: 1632447
Title: bad PPM maxval
Type: Bug Version: obsolete: 8.4.12
Submitter: nobody Created on: 2007-01-10 14:54:53
Subsystem: 43. Photo Image|PPM Assigned To: dkf
Priority: 6 Severity: Minor
Status: Closed Last Modified: 2013-11-03 11:34:31
Resolution: Fixed Closed By: dkf
    Closed on: 2013-11-03 11:34:31
Description:
If maxval in PPM file header is greater than 255 then the
following will happen:

$ wish
% image create photo f -file x.ppm
PPM image file "x.ppm" has bad maximum intensity value 65535

and no image will be created.

Create x.ppm:
$ xwd -root | xwdtopnm >x.ppm
The maxval depends on the X servers display depth value.
User Comments: dkf added on 2013-11-03 11:34:31:

Fix was indeed nice and localised. In 8.5 and 8.6 trees.


dkf added on 2013-11-03 11:01:57:

The format definition for P6 states that maxval can be up to 65535, with maxvals > 255 indicating that 2 bytes per channel per pixel are to be used (instead of 1).

We should fix (though we will lose information; Tk uses strictly 32 bits per pixel, with 8 for each of R, G, B, and alpha). Priority not very high as this is a fairly rare format variation (and we'll never write it from photo images), but the changes should at least be quite localised to just the PPM format handler.


dkf added on 2007-01-18 16:22:06:
Logged In: YES 
user_id=79902
Originator: NO

What is the magic number for the file? (First line, should be a "P" followed by a number.) I ask because Tk currently only supports a small number of the PNM formats and only a small number of widths too. This can be changed, but I need to understand more to know how to change it. :-)

nobody added on 2007-01-18 00:10:02:
Logged In: NO 

I (the submitter) forgot to provide my e-mail address: pme at prolan dot hu