Hi,
I use GDIPlusConvertImage( cImageIni, cImageEnd ) function to convert but It only converts first page to jpg file. Is there any workaround?
Thanks.
FUNCTION frametif()
LOCAL i
LOCAL oBmp := GDIBmp():New( )
LOCAL hbmp := GDIPLOADDIRECTIMAGE("yo.tif" )
LOCAL nFrames = GDIPLUSIMGGETFRAMECOUNT( hbmp )
Msginfo( nFrames )
FOR i = 1 TO nFrames
obmp:hbmp = GDIPLUSIMGGETFRAME( hbmp, i )
obmp:save( "tu"+AllTrim(Str(i))+".jpg")
oBmp:END()
NEXT
obmp:hbmp = hbmp
obmp:END()
RETURN nil
ICRA_Fnc.obj : error LNK2001: çözümlenmemiş dış sembol _HB_FUN_GDIPLOADDIRECTIMAGE
ICRA_Fnc.obj : error LNK2001: çözümlenmemiş dış sembol _HB_FUN_GDIPLUSIMGGETFRAMECOUNT
ICRA_Fnc.obj : error LNK2001: çözümlenmemiş dış sembol _HB_FUN_GDIPLUSIMGGETFRAME
HB_FUNC ( GDIPLOADDIRECTIMAGE )
{
LPWSTR file = AnsiToWide( ( char * ) hb_parc( 1 ) );
Bitmap * original = new Bitmap(file );
hb_retptr( original );
}
HB_FUNC( GDIPLUSIMGGETFRAMECOUNT )
{
Bitmap * original = ( Bitmap * ) hb_parptr( 1 );
UINT nFrame = original->GetFrameDimensionsCount();
GUID* pDimensionIDs = ( GUID* )malloc( sizeof(GUID)*nFrame );
original->GetFrameDimensionsList(pDimensionIDs, nFrame);
UINT frameCount = original->GetFrameCount(pDimensionIDs );
free( pDimensionIDs );
hb_retni( frameCount );
}
HB_FUNC( GDIPLUSIMGGETFRAME )
{
Bitmap * gifImage = ( Bitmap * ) hb_parptr( 1 );
int index = hb_parni(2) ;
UINT nFrame = gifImage->GetFrameDimensionsCount();
GUID* pDimensionIDs = (GUID*)malloc(sizeof(GUID)*nFrame);
gifImage->GetFrameDimensionsList( pDimensionIDs, nFrame);
gifImage->SelectActiveFrame( pDimensionIDs , index );
int nWidth = gifImage->GetWidth() ;
int nHeight = gifImage->GetHeight() ;
Bitmap * frameImage = new Bitmap( nWidth, nHeight );
Graphics * gr = new Graphics( frameImage );
gr->DrawImage(gifImage, 0, 0, nWidth, nHeight);
free( pDimensionIDs ) ;
delete gr ;
hb_retptr( frameImage );
}
4284 **----------------------------------------------------------------------
4285 #pragma BEGINDUMP
4286 #define _WIN32_WINNT 0x0500
4287 #define WINVER 0x0500
4288 #include "windows.h"
4289 #include "hbapi.h"
4290 HB_FUNC( GETINPUTSTATE )
4291 {
4292 LASTINPUTINFO lpi;
4293 lpi.cbSize = sizeof(LASTINPUTINFO);
4294 if (!GetLastInputInfo(&lpi))
4295 {
4296 hb_retni(0);
4297 }
4298 hb_retni(lpi.dwTime);
4299 }
4300
4301 HB_FUNC ( GDIPLOADDIRECTIMAGE )
4302 {
4303 LPWSTR file = AnsiToWide( ( char * ) hb_parc( 1 ) );
4304 Bitmap * original = new Bitmap(file );
4305 hb_retptr( original );
4306 }
4307
4308 HB_FUNC( GDIPLUSIMGGETFRAMECOUNT )
4309 {
4310 Bitmap * original = ( Bitmap * ) hb_parptr( 1 );
4311
4312 UINT nFrame = original->GetFrameDimensionsCount();
4313 GUID* pDimensionIDs = ( GUID* )malloc( sizeof(GUID)*nFrame );
4314
4315 original->GetFrameDimensionsList(pDimensionIDs, nFrame);
4316 UINT frameCount = original->GetFrameCount(pDimensionIDs );
4317 free( pDimensionIDs );
4318 hb_retni( frameCount );
4319 }
4320
4321 HB_FUNC( GDIPLUSIMGGETFRAME )
4322 {
4323 Bitmap * gifImage = ( Bitmap * ) hb_parptr( 1 );
4324 int index = hb_parni(2) ;
4325
4326 UINT nFrame = gifImage->GetFrameDimensionsCount();
4327
4328 GUID* pDimensionIDs = (GUID*)malloc(sizeof(GUID)*nFrame);
4329
4330 gifImage->GetFrameDimensionsList( pDimensionIDs, nFrame);
4331
4332 gifImage->SelectActiveFrame( pDimensionIDs , index );
4333
4334 int nWidth = gifImage->GetWidth() ;
4335 int nHeight = gifImage->GetHeight() ;
4336
4337 Bitmap * frameImage = new Bitmap( nWidth, nHeight );
4338 Graphics * gr = new Graphics( frameImage );
4339
4340 gr->DrawImage(gifImage, 0, 0, nWidth, nHeight);
4341
4342 free( pDimensionIDs ) ;
4343 delete gr ;
4344
4345 hb_retptr( frameImage );
4346 }
4347 #pragma ENDDUMP
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30040 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
TApplication.c
.\TApplication.prg(4303): error C3861: 'AnsiToWide': identifier not found
.\TApplication.prg(4304): error C2065: 'Bitmap': undeclared identifier
.\TApplication.prg(4304): error C2065: 'original': undeclared identifier
.\TApplication.prg(4304): error C2061: syntax error: identifier 'Bitmap'
.\TApplication.prg(4305): error C2065: 'original': undeclared identifier
.\TApplication.prg(4310): error C2065: 'Bitmap': undeclared identifier
.\TApplication.prg(4310): error C2065: 'original': undeclared identifier
.\TApplication.prg(4310): error C2065: 'Bitmap': undeclared identifier
.\TApplication.prg(4310): error C2059: syntax error: ')'
.\TApplication.prg(4312): error C2065: 'original': undeclared identifier
.\TApplication.prg(4315): error C2065: 'original': undeclared identifier
.\TApplication.prg(4316): error C2065: 'original': undeclared identifier
.\TApplication.prg(4323): error C2065: 'Bitmap': undeclared identifier
.\TApplication.prg(4323): error C2065: 'gifImage': undeclared identifier
.\TApplication.prg(4323): error C2065: 'Bitmap': undeclared identifier
.\TApplication.prg(4323): error C2059: syntax error: ')'
.\TApplication.prg(4326): error C2065: 'gifImage': undeclared identifier
.\TApplication.prg(4330): error C2065: 'gifImage': undeclared identifier
.\TApplication.prg(4332): error C2065: 'gifImage': undeclared identifier
.\TApplication.prg(4334): error C2065: 'gifImage': undeclared identifier
.\TApplication.prg(4335): error C2065: 'gifImage': undeclared identifier
.\TApplication.prg(4337): error C2065: 'Bitmap': undeclared identifier
.\TApplication.prg(4337): error C2065: 'frameImage': undeclared identifier
.\TApplication.prg(4337): error C2061: syntax error: identifier 'Bitmap'
.\TApplication.prg(4338): error C2065: 'Graphics': undeclared identifier
.\TApplication.prg(4338): error C2065: 'gr': undeclared identifier
.\TApplication.prg(4338): error C2061: syntax error: identifier 'Graphics'
.\TApplication.prg(4340): error C2065: 'gr': undeclared identifier
.\TApplication.prg(4340): error C2065: 'gifImage': undeclared identifier
.\TApplication.prg(4343): error C2065: 'gr': undeclared identifier
.\TApplication.prg(4343): error C2541: 'delete': cannot delete objects that are
not pointers
.\TApplication.prg(4345): error C2065: 'frameImage': undeclared identifier
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio\2019
\Community\VC\Tools\MSVC\14.29.30037\bin\HostX86\x86\cl.exe"' : return code '0x2
'
Stop.
mastintin wrote:in fwh distribution ...
c:\fwh\source\winapi\gdiplus.cpp file, copy this file in your directory files code and add this lines , add this file in your makefile and compile ...
FiveH32.lib(TGDIPLUS.obj) : error LNK2001: unresolved external symbol _HB_FUN_CFILENAMENOEXT
IcraW.exe : fatal error LNK1120: 1 unresolved externals
FUNCTION cFileNameNoExt(cText)
RETURN cFileNoExt(cText)
Antonio Linares wrote:Hakan,
many thanks for your feedback
Is it working as expected ?
FUNCTION TIFFtoJPG(cFileTIF, cFileJPG)
LOCAL i, aResult := {}, clocal
LOCAL oBmp := GDIBmp():New( )
LOCAL hbmp := GDIPLUSLOADDIRECTIMAGE(cFileTIF)
LOCAL nFrames := GDIPLUSIMGGETFRAMECOUNT( hbmp )
// Msginfo( nFrames )
FOR i = 1 TO nFrames
obmp:hbmp = GDIPLUSIMGGETFRAME( hbmp, i )
clocal := cFilePath(cFileJPG)+cFileNoExt(cFileJPG)+"_"+AllTrim(Str(i))+".jpg"
obmp:save( clocal )
oBmp:END()
AAdd(aResult, {cFileTIF, clocal})
NEXT
obmp:hbmp = hbmp
obmp:END()
RETURN aResult
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 90 guests