Steve,
I changed the '_newimage' to 64x64x32 - it made it a bit hard to 'read' the text output, but the upside is, all images created were 64x64.
It's this little demo code which you're looking at, I assume:
'$INCLUDE:'SaveImage.BI'
CONST SaveTextAs256Color
= 0 'Flag to Save as 256 color file or 32-bit color file, when converting SCREEN 0 to an image ' Set to TRUE (any non-zero value) to save text screens in 256 color mode.
' Set to FALSE (zero) to save text screens in 32-bit color mode.
'CONST ConvertToStandard256Palette = 0
' Set the value to 0 (FALSE) to preseve the color information perfectly, using its default palette.
' If the CONST is set (TRUE), then we convert our colors to as close of a match as possible, while
' preserving the standard QB64 256-color palette.
' Commented here, simply to help folks know that it exists for use when converting a 32 bit image
' down to 256 colors, such as what the GIF routine has to do for us (GIFs are limited to 256 color images)
InitialImage$ = "Volcano Logo.jpg"
exportimage(1) = "testimage.png": exportimage(2) = "testimage.bmp"
exportimage(3) = "testimage.jpg": exportimage(4) = "testimage.gif"
'If you want to test the demo with a screen 0 image, then...
l&
= _LOADIMAGE(InitialImage$
) 'Remark out this line'_PUTIMAGE , l& 'And remark the _PUTIMAGE line down below as well
'And unremark the following
'SCREEN 0
'FOR i = 0 TO 15
' COLOR i
' PRINT "COLOR i"
'NEXT
'Then you can watch as we prove that we can save images while in Screen 0 TEXT mode.
_PUTIMAGE , l&
'Remark out this line, if you want to see the SCREEN 0 demo Result
= SaveImage
(exportimage
(i
), 0, 0, 0, _WIDTH - 1, _HEIGHT - 1) IF Result
= 1 THEN 'file already found on drive KILL exportimage
(i
) 'delete the old file Result
= SaveImage
(exportimage
(i
), 0, 0, 0, _WIDTH - 1, _HEIGHT - 1) 'save the new one again IF Result
< 0 THEN PRINT "Successful " + exportimage
(i
) + " export" ELSE PRINT ext$
+ " Export failed with Error Code:"; Result:
' END
PRINT "Image Handle: "; zz&
, exportimage
(i
) PRINT "Successful Import using _LOADIMAGE" PRINT "ERROR - Not Loading the new image (" + exportimage
(i
) + ") with _LOADIMAGE."
'$INCLUDE:'SaveImage.BM'
If you notice, there's 3 particular lines of interest going on here, which affect your resolution:
SCREEN _NEWIMAGE(1280, 720, 32) -- This sets the screen image to 1280x720.
l& = _LOADIMAGE(InitialImage$) -- This loads an image into the demo.
_PUTIMAGE , l& 'Remark out this line, if you want to see the SCREEN 0 demo -- This line puts the image to the main screen, making it a 1280x720 picture
And, once those 3 things are taken into consideration, we call the SaveImage routine with:
Result = SaveImage(exportimage(i), 0, 0, 0, _WIDTH - 1, _HEIGHT - 1)
Now, to break down that Function, let's take a look at the BM file and view the syntax:
FUNCTION SaveImage (file$, image&, x1%, y1%, x2%, y2%)
So, now you can make sense of what all those 0's and such we're sending the function does:
exportimage(i) -- this is the name of the file which we want to save to, on the disk. In this case, it's in a loop with 4 different names, so we save in all 4 available formats.
, 0 -- this is the screen/image handle which we're exporting from. A 0 designates, "use the visisble display screen", so that's the 1280x720 screen we put the image on -- NOT the original image itself.
, 0, 0, _WIDTH - 1, _HEIGHT - 1 -- and this is the screen dimensions which we want to capture and save. From (0,0) to (_WIDTH -1, _HEIGHT -1) - basically, the whole 1280x720 screen image.
Now, if you wanted to simply load and convert your original image, you could make a simple change to that export line:
Result = SaveImage(exportimage(i),
l&, 0, 0,
_WIDTH(l&) - 1,
_HEIGHT(l&) - 1)
With the above, you can see that I'm now pointing the command to work with the image handle that we'd loaded, and not the visible display screen (l& instead of that first 0). I've also changed it so that it's getting the width and height of the image, and not the display with _WIDTH(l&) and _HEIGHT(l&).
Point it at the right image, and you'll get the right resolutions. By putting the image to an enlarged screen, and then saving that enlarged screen, you get the enlarged images on saving -- which isn't exactly what you're wanting to do at all, in this case.
There's no bug in there: it's all working as it should, from what I can tell. ;)