Ich hab folgendes Problem:
Und zwar wird bei mir der das Bild abgeschnitten, wenn das Bild breiter ist als die vorgegebene Größe.

Hier mal mein Code:
Code: Alles auswählen
Procedure ResizeImageEx(Image,Width,Height,BackColor)
If IsImage(Image) And Width And Height
ImgWidth=ImageWidth(Image)
ImgHeight=ImageHeight(Image)
If ImgWidth>Width Or ImgHeight>Height
Factor.f=ImgWidth/ImgHeight
If ImgWidth>Width
NewWidth=Width
NewHeight=NewWidth/Factor
EndIf
If ImgHeight>Height
NewHeight=Height
NewWidth=NewHeight*Factor
EndIf
Else
NewWidth=Width
NewHeight=Height
EndIf
ResizeImage(Image,NewWidth,NewHeight)
If Width>NewWidth
x=Width-NewWidth
x-x/2
EndIf
If Height>NewHeight
y=Height-NewHeight
y-y/2
EndIf
Img=CreateImage(#PB_Any,Width,Height)
If IsImage(Img) And IsImage(Image)
If StartDrawing(ImageOutput(Img))
Box(0,0,Width,Height,BackColor)
DrawImage(ImageID(Image),x,y)
StopDrawing()
EndIf
CopyImage(Img,Image)
FreeImage(Img)
ProcedureReturn 1
EndIf
EndIf
EndProcedure