The picture is too big

The picture is too big

Postby Natter » Thu Aug 15, 2024 1: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
Natter
 
Posts: 1221
Joined: Mon May 14, 2007 9:49 am

Re: The picture is too big

Postby Natter » Thu Aug 15, 2024 9: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 ?
Natter
 
Posts: 1221
Joined: Mon May 14, 2007 9:49 am

Re: The picture is too big

Postby Antonio Linares » Fri Aug 16, 2024 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: The picture is too big

Postby nageswaragunupudi » Sat Aug 17, 2024 2: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: Select all  Expand view
#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
User avatar
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: The picture is too big

Postby nageswaragunupudi » Sat Aug 17, 2024 3:47 am

montage with FWH
Code: Select all  Expand view
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
User avatar
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: The picture is too big

Postby Natter » Sat Aug 17, 2024 9: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 ?
Natter
 
Posts: 1221
Joined: Mon May 14, 2007 9:49 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 98 guests