22
A bug in PhotoPlus • When PhotoPlus X2, version 12.0.2.11, is used to create a new .bmp file, it does not create the Pixel Data correctly • This bug may have been removed in later versions of the package but we will consider it in some detail here, because it illustrates how frequently software packages have bugs or "features" which deviate from the standards they are supposed to follow

A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

A bug in PhotoPlus• When PhotoPlus X2, version 12.0.2.11, is

used to create a new .bmp file, it does not create the Pixel Data correctly

• This bug may have been removed in later versions of the package but we will consider it in some detail here, because it illustrates how frequently software packages have bugs or "features" which deviate from the standards they are supposed to follow

Page 2: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Creating a new .bmp file in PhotoPlus• We are starting a new 4-by-4 image

Page 3: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Creating a new .bmp file in PhotoPlus• We have just painted the pixels

Page 4: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Creating a new .bmp file in PhotoPlus• We are just about to export the image to test4By4.bmp

Page 5: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Viewing the new .bmp file in PhotoPlus• We are about to open the image we just created in test4By4.bmp

Page 6: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Viewing the new .bmp file in PhotoPlus• The image in test4By4.bmp appears wrong when we open it• Let's try to view it in other programs

Page 7: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Viewing the new .bmp file in MS Paint• The test4By4.bmp image also appears wrong in MS Paint

Page 8: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Viewing the new .bmp file in Opera• The test4By4.bmp image also appears wrong in Opera

Page 9: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Viewing the new .bmp file in Firefox• The test4By4.bmp image also appears wrong in Firefox

Page 10: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Viewing the new .bmp file in XVI32

• It is easy to see that the image in test4By4.bmp is not what we stored

• All the Pixel Data bytes are 00• So they are pointing to the

same entry in the Colour Table

Page 11: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Creating an (almost) correct .bmp file in PhotoPlus

• We cannot export a new correct .bmp file from PhotoPlus, but ...

• When Photoplus imports a correct .bmp file (one created by another editor, including XVI32), it seems not to introduce errors when we subsequently export it

• Also, when Photplus imports an almost correct .jpg file, it creates a correct .bmp file when we export the image as a .bmp

Page 12: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Creating, indirectly, an (almost) correct .bmp file in PhotoPlus

• We have just painted the pixels for a new image• We are about to export the image as .jpg file

Page 13: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Creating, indirectly, an (almost) correct .bmp file in PhotoPlus

• We have just opened the .jpg file containing the image we exported

• The image looks correct

• We are about to export the newly opened image as .bmp file

Page 14: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Examining the (almost) correct .bmp file in PhotoPlus

• We have just opened the newly exported .bmp file

• It looks correct, but is it?

• On the next slide, we will examine the .bmp file in XVI32

Page 15: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Examining the (almost) correct .bmp file in XVI32

• The Pixel Data look correct• There are four sequences of four bytes• 00 00 00 00 01 01 01 01 00 00 00 00 01 01 01 01• On the next slide, we will look at the Colour Table

Page 16: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Examining the (almost) correct .bmp file in XVI32

• The Colour Table is not quite right• The Green is correct: 00 FF 00 00 • But the Red is slightly off: 00 00 FE 00• This is a result of the sampling done when the .jpg file was exported• As we will see on the next slide, there is something else ...

Page 17: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Examining the (almost) correct .bmp file in XVI32

• There is also a problem in the Info Header• The ColorsUsed and ColorsImportant fields are set to all zeros• This is wrong

– ColoursUsed should 00 01 00 00

– ColorsImportant should be 02 00 00 00

• The fact that the .bmp file displays correctly in PhotoPlus, MS Paint and the various browsers just shows that these programs do not pay much attention to these two fields in the Info Header

Page 18: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Correcting the (almost) correct .bmp file in XVI32

• We can correct the .bmp file by setting the bytes highlighted below to the values shown

• Below, we have just saved the edited image in a file called test4By4newCorrected.bmp

• On the next few slides, we will view this file in various programs

Page 19: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Viewing the corrected .bmp file in PhotoPlus

• Below, we have just opened the image in test4By4newCorrected.bmp in PhotoPlus

• It looks fine

Page 20: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Viewing the corrected .bmp file in MS Paint

• Below, we have just opened the image in test4By4newCorrected.bmp in MS Paint

• It looks fine

Page 21: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Viewing the corrected .bmp file in Opera

• Below, we have just opened the image in test4By4newCorrected.bmp in Opera

• It looks fine

Page 22: A bug in PhotoPlus When PhotoPlus X2, version 12.0.2.11, is used to create a new.bmp file, it does not create the Pixel Data correctly This bug may have

Viewing the corrected .bmp file in Firefox

• Below, we have just opened the image in test4By4newCorrected.bmp in Firefox

• It looks fine