When playing with images or drawings I allways prefer to see what is going on.
Create a window with an image gadget to load your created image. Allways run the code with debugger enabled.
This code creates a window loads bouquet.jpg shows what you have drawn then saves into the same folder as the original.
Code: Select all
UseJPEGImageDecoder()
UseJPEGImageEncoder()
Global Window_0
Global Image_0
Window_0 = OpenWindow(#PB_Any, 0, 0, 650, 650, "", #PB_Window_SystemMenu)
Image_0 = ImageGadget(#PB_Any, 5, 5, 600, 600, 0)
LoadImage(0, "bouquet.jpg") ; image existing at the same folder
;Image 0 is the bouquet
If CreateImage(1, 600, 600) And StartDrawing(ImageOutput(1))
DrawingMode(#PB_2DDrawing_Transparent)
Box(0, 0, 600, 600, RGB(0, 255, 0))
;Choose either of the two below
;Draw Bouquet image at original size in bottom right hand corner
; DrawImage(ImageID(0), 500, 500)
;Draw Bouquet image resized in bottom right hand corner
DrawImage(ImageID(0), 500, 500,100,100)
StopDrawing()
EndIf
SetGadgetState(Image_0,ImageID(1))
SaveImage(1, "Bouquet2.jpg")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow
End
Case #PB_Event_Menu
Select EventMenu()
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ForEver
I changed your box to green to see what is happening to the box.
Remember to create a folder for your programme as well then if you can edit the programme you can save there.
CD
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.