Can someone tell me why the saving part of this doesnt work?
(there's a lot of fluff code in there, sorry!)
(there's a lot of fluff code in there, sorry!)
Graphics 1280, 1024, 32, 1 Global imageid, image, bias Global r, g, b, av, n, m, bw, save, savename SetBuffer FrontBuffer() imageid=Input$("Image name and extension : ") bias=Input$("To what nearest number should the rgb's be rounded to? ") bw=Input$("Should the output image be black and white? (y/n) ") ;bias = Float bias ;bias = bias/(bias*10) If bias=0 Then bias=10 image=LoadImage ("image.jpg") Cls save=CreateImage(ImageWidth(image), ImageHeight(image)) DrawImage image, 0, 0 DrawImage image, 0, ImageHeight(image) WaitKey() For n=0 To ImageWidth (image) For m=0 To ImageHeight (image) GetColor n, m r=ColorRed() g=ColorGreen() b=ColorRed() If bw="y" Then r=(round( r, bias)) g=(round( g, bias)) b=(round( b, bias)) av = (r + g + b) / 3 r = av : g = av : b = av Else r=(round( r, bias)) g=(round( g, bias)) b=(round( b, bias)) EndIf Color r, g, b ;Plot 1280, 0 Rect 1000, 1000, 2, 2, 1 If ImageHeight(image) < 500 Then WritePixelFast n, m + ImageHeight (image), ReadPixelFast(1000, 1000) Else WritePixel n, m + ImageHeight (image) , ReadPixel(1000, 1000) EndIf DrawImage save, 0, ImageHeight(image) If KeyHit(1) Then Goto endl Next Next CopyRect 0, ImageHeight(image), ImageWidth(image), ImageHeight(image), 0, 0, ImageBuffer(save) DrawImage save, 0, 0 Repeat Color 0, 0, 0 Rect 1000, 1000, 280, 24, 1 GetColor MouseX(), MouseY() Text 1000, 1000, "mouse location rgb = " + ColorRed() + " " + ColorGreen() + " " + ColorBlue() Text 1000, 900, "Hit spacebar to save the new image, escape to quit" If KeyHit( 57 ) Then Locate 900, 980 savename=Input$("New image filename? (will save as bitmap) ") SaveImage (save, savename+".bmp") EndIf Delay 15 Until KeyHit(1) .endl End Function Round( Number , N ) If ( Number Mod N ) >= ( N *.5 ) Number = ( Ceil( Number / N ) + 1 ) * N Else Number = Floor( Number / N ) * N EndIf Return Number End Function Function writepixelsfast() If ImageHeight(image)*2 > 1024 Then WritePixelFast n+ImageWidth(image), m, ReadPixelFast(1000, 1000) Else If ImageWidth*2 > 1280 Then WritePixelFast n, m+ImageHeight (image), ReadPixelFast(1000, 1000) EndIf End Function Function writepixels() If ImageHeight(image)*2 > 1024 Then WritePixel n+ImageWidth(image), m, ReadPixel(1000, 1000) Else If ImageWidth*2 > 1280 Then WritePixel n, m+ImageHeight (image), ReadPixel(1000, 1000) EndIf End Function