v0.0.488 fix wpdf with 16bpp images
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 4m9s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 4m9s
This commit is contained in:
parent
49d423915c
commit
1310054121
@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.487"
|
const GoextVersion = "0.0.488"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2024-07-18T17:45:56+0200"
|
const GoextVersionTimestamp = "2024-07-22T15:16:28+0200"
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"gogs.mikescher.com/BlackForestBytes/goext/langext"
|
"gogs.mikescher.com/BlackForestBytes/goext/langext"
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
|
"image/draw"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -284,6 +285,13 @@ func (b *WPDFBuilder) Image(img *PDFImageRef, opts ...*PDFImageOpt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if dataimg.ColorModel() != color.RGBAModel && dataimg.ColorModel() != color.NRGBAModel {
|
||||||
|
// the image cannto be 16bpp or similar - otherwise fpdf errors out
|
||||||
|
dataImgRGBA := image.NewNRGBA(image.Rect(0, 0, dataimg.Bounds().Dx(), dataimg.Bounds().Dy()))
|
||||||
|
draw.Draw(dataImgRGBA, dataImgRGBA.Bounds(), dataimg, dataimg.Bounds().Min, draw.Src)
|
||||||
|
dataimg = dataImgRGBA
|
||||||
|
}
|
||||||
|
|
||||||
bfr, imgMime, err := imageext.EncodeImage(dataimg, compression)
|
bfr, imgMime, err := imageext.EncodeImage(dataimg, compression)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.b.SetError(err)
|
b.b.SetError(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user