change background file PNG inside .pgm

change background file PNG inside .pgm

Postby damianodec » Wed Nov 14, 2018 3:59 pm

hi,
I have to print some PNG files:
Code: Select all  Expand view

oprn:SayImage(1000, 900, "c:\fileImage.png", 1500)

there are some files with black background:
Image
I can not to change background into the file, Is there any way to change background inside source prg and then print ?
thanks
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 414
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: change background file PNG inside .pgm

Postby ukoenig » Wed Nov 14, 2018 6:43 pm

I think in case of black and white printing
You have to convert the images to NEGATIVE

You can use GIMP ( freeware )
select option < Colors > -> < Invert >

Image

regards
Uwe :D
Last edited by ukoenig on Fri Nov 16, 2018 8:15 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: change background file PNG inside .pgm

Postby damianodec » Thu Nov 15, 2018 8:02 am

hi Uwe, thank you for reply.
I haev about 2000 files, in my pgm users insert "code number" and print report of article with file PNG.
it's very compicated change signle file by GMIP and I thought it could be done inside pgm with some function...
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 414
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: change background file PNG inside .pgm

Postby ukoenig » Thu Nov 15, 2018 9:57 am

I'm not sure if xImage or FREEIMAGE supports NEGATIV - painting. :?:
There is another possible solution using GIMP as a commandline-tool ( script )

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: change background file PNG inside .pgm

Postby nageswaragunupudi » Fri Nov 16, 2018 9:43 am

Please try if this approach works for you.

Code: Select all  Expand view
#include "fivewin.ch"

#define SRCCOPY      0x00CC0020
#define SRCINVERT    0x00660046

function Main()

   local oPrn, aBmp, nBmpHeight, nRow
   local cFile := "c:\fwh\bitmaps\alphabmp\handnew.bmp"

   PRINT oPrn PREVIEW
   PAGE

   aBmp        := FW_ReadImage( nil, cFile )
   nBmpHeight  := aBmp[ 4 ]

   nRow        := 300
   oPrn:Say( nRow, 300, "Print Normal" )

   nRow  += 100
   DrawBitmap( oPrn:hDCOut, aBmp[ 1 ], nRow, 300, 0, 0, SRCCOPY )

   nRow  += ( nBmpHeight + 100 )
   oPrn:Say( nRow, 200, "Print Negative" )
   nRow  += 100
   DrawBitmap( oPrn:hDCOut, aBmp[ 1 ], nRow, 300, 0, 0, SRCINVERT )

   ENDPAGE

   ENDPRINT

   PalBmpFree( aBmp )

return nil
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10308
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: change background file PNG inside .pgm

Postby damianodec » Fri Nov 23, 2018 3:32 pm

thank you mr. Rao
very good,
I'll try it next week.
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 414
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: change background file PNG inside .pgm

Postby damianodec » Thu Jan 24, 2019 2:43 pm

hi mr.Rao,
now I working again to this project but I have FiveWin for xHarbour 17.09 - Sep. 2017 and inside this version there is not FW_ReadImage
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 414
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: change background file PNG inside .pgm

Postby nageswaragunupudi » Thu Jan 24, 2019 2:56 pm

FW_ReadImage() works from FWH 18.01.
For FWH 1709, please use a similar function "WndReadPalBmpEx(...)" with the same syntax.
Please let me know if this works for you.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10308
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: change background file PNG inside .pgm

Postby damianodec » Thu Jan 24, 2019 3:36 pm

hi, it's works good.

now I have another question:
how can I know that background of bmp file is black or white ?
thank you
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 414
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: change background file PNG inside .pgm

Postby damianodec » Tue Jan 29, 2019 4:31 pm

hi,
how can I to zoom bmp file by DrawBitmap function ?

thanks
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 414
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Jimmy and 35 guests