Maybe its a good idea to post some test code...
Code: Select all
#OrgSprite = 1
#IntermediateSprite = 2
#NewSprite = 3
InitSprite()
UseJPEGImageDecoder()
OpenWindow(1,0,0,640,480,#PB_Window_SystemMenu,"ImageConverter")
OpenWindowedScreen( WindowID(),0,0,2726,2282,1,0,0)
; size of Hpim0212.jpg = 2272x1712
ResultLoadSprite = LoadSprite(#OrgSprite, "Hpim0212.jpg" , #PB_Sprite_Memory)
;Debug ResultLoadSprite
ResultSpriteWidth = SpriteWidth(#OrgSprite)
;Debug ResultSpriteWidth
ResultSpriteHeight = SpriteHeight(#OrgSprite)
;Debug ResultSpriteHeight
;Calldebugger
Width = ResultSpriteWidth + (ResultSpriteWidth / 5)
Height = ResultSpriteHeight + (ResultSpriteHeight / 3)
CreateSprite(#IntermediateSprite, Width, Height, #PB_Sprite_Memory)
DisplaySprite(#IntermediateSprite, 0, 0)
DisplayRGBFilter(0, 0, 2726, 2282, 255, 255, 255)
DisplaySprite(#OrgSprite, ResultSpriteWidth / 10, ResultSpriteHeight / 6)
Repeat
Event = WaitWindowEvent()
FlipBuffers()
Delay(20)
Until Event = #PB_Event_CloseWindow
GrabSprite(#NewSprite, 0, 0, 2726, 2282, #PB_Sprite_Memory)
;Debug SaveSprite(#NewSprite, "Hpim0212NEW.bmp", #PB_ImagePlugin_BMP) ; this works
Debug SaveSprite(#NewSprite, "Hpim0212NEW.jpg", #PB_ImagePlugin_JPEG) ; this NOT!!!
CallDebugger
BTW: it would have been nice to do this exersise completely in memory instead of displaying it - but you can't load sprites without opening a screen, and CopySprite always changes the size of the CopyToSprite.
Maybe:
CopySprite(#Sprite1, #Sprite2 [, Mode])
should be changed in:
CopySprite(#Sprite1, x of Sprite2, y of Sprite2, #Sprite2 [, Mode])
without changing the size of Sprite1,so it's possible to copy/overlay a new Sprite over an old one and be able to specify the position.