FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour The picture is too big
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
The picture is too big
Posted: Thu Aug 15, 2024 01:46 PM

Hi,

If you make a 7016x4961 (A2) image and save it to a png file, then everything is fine.

FW_SaveImage(hBmp, "myfile.png")->.T.

However, if you make an image 9933x4961 (A1), the file is not saved

FW_SaveImage(hBmp, "myfile.png")->.F.

That is, if the picture is too big, then it does not have enough memory to save to a file. How can I get around this obstacle ?

FW 24.02

Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: The picture is too big
Posted: Thu Aug 15, 2024 09:32 PM
I'll probably make some small .png files and glue them (from below) using the imagemagick utility into a single .png file. Can anyone tell me how to write a command for imagemagick ?
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: The picture is too big
Posted: Fri Aug 16, 2024 07:36 AM
To combine multiple PNG files into a single image using ImageMagick, you have a couple of options:

Using montage:
If you want to create a grid-like arrangement of images, you can use the montage function. For example:
cd /path/to/your/images
montage *.png -tile 2x -geometry +1+1 output.png
This command will create a 2x2 grid of images (you can adjust the -tile and -geometry options as needed).
Using -composite:
If you want to overlay one image on top of another (e.g., watermarking), you can use the -composite option. For example:
convert "bottom00.png" "top00.png" -composite "output00.png"
This command will overlay "top00.png" on top of "bottom00.png" and save the result as "output00.png"
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: The picture is too big
Posted: Sat Aug 17, 2024 02:34 AM
However, if you make an image 9933x4961 (A1), the file is not saved
FW_SaveImage(hBmp, "myfile.png")->.F.

That is, if the picture is too big, then it does not have enough memory to save to a file. How can I get around this obstacle ?
No please.
I just checked and FWH can create PNG file with size 9933x4961.
This is my test program
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local hBmp, aBmp, oBrush

   DEFINE BRUSH oBrush FILE "..\bitmaps\backgrnd\wood.bmp"

   hBmp  := FW_MakeYourBitmap( 9933, 4961, <|hDC,w,h|
            local aBmp := FW_ReadImage( nil, "..\bitmaps\sea.bmp" )
            local i, j, r, c
            r  := 200
            for i := 1 to 6
               c  := 300
               for j := 1 to 9
                  FW_DrawImage( hDC, aBmp, { r,c,r+768,c+1024 } )
                  c  += 1024
               next
               r  += 768
            next
            PalBmpFree( aBmp )
            return nil
            >, oBrush:hBrush ) //CLR_WHITE )

   RELEASE BRUSH oBrush

   FErase( "x.png" )
   ? FW_SaveImage( hBmp, "x.png" ) // -> .t.
   DeleteObject( hBmp )
   ? File( "x.png" ) // -> .t. .. proof of creation

   aBmp := FW_ReadImage( nil, "X.PNG" )
   xImage( aBmp[ 1 ], "x.img : " + cValToChar( aBmp[ 3 ] ) + "x" + cValToChar( aBmp[ 4 ] ) )
   PalBmpFree( aBmp )

return nil
You can download the full size png file from this link:
https://we.tl/t-nNdLwKbrR1
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: The picture is too big
Posted: Sat Aug 17, 2024 03:47 AM
montage with FWH
Code (fw): Select all Collapse
function Montage()

   local cImage1  := "..\bitmaps\sea.bmp"
   local cImage2  := "..\bitmaps\hires\earth.bmp(1000x720)"
   local hNew

   hNew  := FW_StitchImages( cImage1, cImage2, "B" )

   XImage( hNew )

return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: The picture is too big
Posted: Sat Aug 17, 2024 09:44 AM
Rao, in this case, your method is not suitable, because I am dealing with a map. Before creating a bitmap file from it, I must increase its format according to the requested format (A0,A1,A2) and accordingly expand the size of the window per screen. If this is not done, the image blurs when zoomed in.
I made the A2 bitmap file in your way https://cloud.mail.ru/public/ymXZ/kBcZu7dFK
and mine https://cloud.mail.ru/public/7fz2/NbJR33uzd.

where to read about the FW_Switchimages function and its parameters ?

Continue the discussion