Page 1 of 1

ResizeImage with #PB_Image_Raw doesn't work with 32-bit images

Posted: Fri Mar 10, 2023 4:13 am
by wombats
ResizeImage with #PB_Image_Raw doesn't seem to work with 32-bit images. Change it to #PB_Image_Smooth and it'll work. It works on macOS.

Code: Select all

CreateImage(0, 100, 100, 32, #PB_Image_Transparent)

LoadFont(0, "Arial", 10)

If StartVectorDrawing(ImageVectorOutput(0))
  VectorFont(FontID(0), 12)
  DrawVectorText("Hello World")
  StopDrawing()
EndIf

OpenWindow(0, 100, 100, 400, 350, "", #PB_Window_SystemMenu)

CanvasGadget(0, 0, 0, 400, 350)

ResizeImage(0, 200, 200, #PB_Image_Raw)

If StartDrawing(CanvasOutput(0))
  DrawingMode(#PB_2DDrawing_AlphaBlend)
  DrawImage(ImageID(0), 50, 50)
  StopDrawing()
EndIf

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

Re: ResizeImage with #PB_Image_Raw doesn't work with 32-bit images

Posted: Fri Apr 21, 2023 5:02 pm
by Fred
The problem here is your image is fully transparent as you don't use alpha channel mode for StartVectorDrawing(). So when using interpolation (with smooth), it also interpolate the alpha value that why it appears (I agree it's a bit weird, but it's how the bicubic algo works). When using raw, it doesn't and your image stay fully transparent.