| Ticket UUID: | 481255 | |||
| Title: | palette 2 doesn't work for windows | |||
| Type: | Bug | Version: | obsolete: 8.4.2 | |
| Submitter: | dzolli | Created on: | 2001-11-13 11:50:35 | |
| Subsystem: | 41. Photo Images | Assigned To: | aku | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2026-10-29 18:58:50 | |
| Resolution: | Fixed | Closed By: | nemethi | |
| Closed on: | 2026-10-29 18:58:50 | |||
| Description: |
When you want to create a black and white photo using the -palette 2 option, you got a corrupted image. But -palette 1 and -palette 3 work for windows and -palette 2 works for linux. | |||
| User Comments: |
nemethi (claiming to be Csaba Nemethi) added on 2026-10-29 18:58:50:
Backported to core-9-0-branch and core-8-6-branch by commits [9572dd82] and [697d9c36]. Closing the ticket. serhiy.storchaka added on 2026-10-26 18:35:22: Fixed in [710caca0d3] (main), with test imgPhInstance-7.3. serhiy.storchaka added on 2026-09-29 19:49:49: Added test imgPhInstance-7.3 to the branch win-mono-image. It checks the pixels of -palette 2 images with testpixel. It fails on Windows without the fix and passes with it. serhiy.storchaka added on 2026-09-28 15:21:12: Still reproducible on Windows with 8.6 and 9.0, for widths 1-16, 33-48, 65-80, etc. There are two bugs:
Proposed fix in branch win-mono-image, with tests imgPhoto-26.*. With it the images are the same as on Linux, pixel for pixel. A test for the colors with testpixel on 9.1 needs the fix for [32f2e19de8] (branch win-photo-gamma-palette) first, since -palette is ignored there on Windows. dzolli added on 2003-05-14 22:32:43: Logged In: YES
user_id=375063
Using the test script bellow with tclkit 8.4.2 this bug remain for
*some* images I tried.
Alas, I can't stat why it works for one and it
doesn't for another.
# Start of Tk test script
# Choose
small images if you want the display
# part (120 square pixels)
been representative.
destroy .c
canvas .c
pack
.c
set imgname [tk_getOpenFile -filetypes [list "{Images}
{*.gif *.ppm *.pgm}"]]
# Full color test :
image create
photo TF -file $imgname
# Palette 2 test :
image create
photo T2 -file $imgname -palette 2
# Palette 16 test :
image
create photo T3 -file $imgname -palette 16
update
idletasks
set h2 [image height TF]
if {$h2 > 120} {
set h2
120
}
set h3 [expr $h2 * 2]
set hc [expr $h2 * 3]
.c
configure -height $hc -width 120
wm geometry .
120x$hc
update
# Display result :
.c create image 0 0 -
anchor nw -image TF
.c create rectangle 30 5 90 20 -width 0 -fill
yellow
.c create text 60 5 -anchor n -text "Full colors" -fill red
.c
create image 0 $h2 -anchor nw -image T2
.c create rectangle 30
[expr $h2+5] 90 [expr $h2+20] -width 0 -fill yellow
.c create text 60
[expr $h2+5] -anchor n -text "2 colors" -fill red
.c create image 0 $h3 -
anchor nw -image T3
.c create rectangle 30 [expr $h3+5] 90 [expr
$h3+20] -width 0 -fill yellow
.c create text 60 [expr $h3+5] -anchor n -
text "16 colors" -fill red
# End of test script
hobbs added on 2002-04-23 07:25:54: Logged In: YES user_id=72656 I believe Chengye commited the fix to the head on 03-26 and just forgot to close this. chengyemao added on 2002-03-26 11:24:27: Logged In: YES user_id=191079 This is a Tk Windows problem and has been there since tk80. This is a change made in XCreateImage in tkWinImage.c. The line in the function XCreateImage imagePtr->bitmap_bit_order = MSBFirst; // line 224 ? specifies the bit order of MSBFirst, which results in bigEndian format in bit packing of tkImgPhoto. I don't know the reason for this change, but believe it is a problem for the option -palette 2. The fix is imagePtr->bitmap_bit_order = LSBFirst; Chengye Mao dkf added on 2002-03-25 17:15:48: Logged In: YES user_id=79902 I know *nothing* about this. Jeff, perhaps you could pass it on to someone who actually understands the fault... | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki