|Subject:||EAN13 barcode with text requires GD::Image palette mode not truecolour|
If you have set the default for GD::Image to truecolour mode using GD::Image->trueColor(1); then when you create an EAN13 barcode with the numbers displayed below, the area where the text would be printed is solid black. This is because the default background colour seems to be set to black when using truecolour mode. In my application the first couple of calls to generate a barcode were working fine, but after displaying another dynamically generated image, the barcodes all had the solid black line underneath instead of text. To confirm it was the background colour at fault, I added a filledRectangle call just after allocating black and white colours so that it fills the newly created image with white. The barcode was then produced as expected. The only thing I could find different was the truecolour setting being set for the other image, adding GD::Image->trueColor(0); before generating the barcode causes it to work correctly every time. Suggested fix would be to set the truecolour mode to false when generating the barcode image, but the above works fine as a workaround for anyone else who discovers the same issue.