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

Just starting out? Need help? Post your questions and find answers here.
wombats
Enthusiast
Enthusiast
Posts: 663
Joined: Thu Dec 29, 2011 5:03 pm

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

Post 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
Fred
Administrator
Administrator
Posts: 16617
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

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

Post 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.
Post Reply