English
Forum

GDI+

 
- Page 1 -



Georg
Hovenbitzer
Hello together,

me erdrückt straight a gigantic Wissenslücke what about me hope your can me help on.
target is it, one Image To loading, it to a Thumbnail To verkleiner and then in a data base to take off.
my trouble is now the part between Thumbnail and Database and there the, How I a Speicheradresse / aray the Bildes and which Size come:
as Presentation have I the geile GDI+ demonstration of Andreas taken.
 $H \windows.ph
 $H \includes\Functions_GDIPLUS.ph
 $H \includes\GDIP_Imageging.ph
 $I \includes\GDIP_Helper.inc
Declare gdiplusToken&,ImageObject&,ImageWidth&,ImageHeight&,GraphicObject&
Declare hPic&
Declare imgThumb&
Declare lngImage&
Declare hBitmap&
Window 0,0-1024,786
Cls ~GetSysColor(~COLOR_3DFACE)
gdiplusToken& = InitGDIPlus()
hPic& = @Create(hPic,-1,Image.jpg)
~GdipCreateBitmapFromHBITMAP(hPic&,0,@Addr(lngImage&))
~GdipGetImageThumbnail(lngImage&,92,69,@Addr(imgThumb&),0,0)
~GdipCreateHBITMAPFromBitmap(imgThumb&,@Addr(hBitmap&))
DrawPic hBitmap&,50,50;0
here bräuchte I now something, what me a address or aray and which Size determined !!!
WaitInput
DeleteObject hPic&
DeleteObject hBitmap&
~GdipDisposeImage(imgThumb&)
~GdipDisposeImage(lngImage&)
ExitGDIPlus(gdiplusToken&)
End
 
Viele Grüsse, Georg Hovenbitzer(Windows XP Pro, XProfan 11.2, Profan2Cpp 1.6a)
02/02/09  
 



 
- Page 2 -



Georg
Hovenbitzer
Hello Pascal,

I have still said, this is a interesting Possibility
To your question whether it border gives, here the original Text from the SQLite Homepage:


Supports terabyte-sized databases and gigabyte-sized strings and blobs.


there has one sooner a problem with Plattenplatz, as with the what into Blobs verstauen wants.
One disadvantage has The DLL tappt im dunkeln can't code, what but time again whom Exportgesetze together hang might.
but I have already a Page found a Verschlüsselung in the Source installed is and one the DLL new Compilieren must.


After appeal of SaveJpgToMem  finds itself the complete code the new erstellten JPG in PicData#.
sure yet verbesserungsfähig,but so could one already what begin..


it works, it works
I see no compel improvement, there it very whom lane goes How the VB demonstration.
The ausgiebige Test comes tommorrow and hereon freue I already.

super many Thanks !!
 
Viele Grüsse, Georg Hovenbitzer(Windows XP Pro, XProfan 11.2, Profan2Cpp 1.6a)
02/04/09  
 




Uwe
''Pascal''
Niemeier
Hi people!

Georg
I see no compel improvement, there it very whom lane goes How the VB demonstration.


the can I not me sit let

here a improved Version, with the altogether only one Stream is used, the too to Rüchverwandlung data > Image  herhält and on the End of program too Correctly again removes becomes.
means quasi one round about-carefree-pkg, the on the side too a virtually function hat; it can as Preview for differently Kompressionsraten with JPG use
CompileMarkSeparation
window 0,0-600,500
 $H windows.ph
--GDIPlus-Erweiterungen von Andreas Miethe
 $H Functions_GDIPLUS.ph
 $H GDIP_Imageging.ph
 $I GDIP_Helper.inc
--Funktionen aus shlwapi.dll unter XP (SP3) nur indirekt per Ordinal erreichbar
var shlwapi&=~GetModulehandle(shlwapi.dll)
var SHCreateMemStream&=~GetProcAddress(shlwapi&,12)
var IStream_Write&=~GetProcAddress(shlwapi&,212)
var IStream_Reset&=~GetProcAddress(shlwapi&,213)
var IStream_Size&= ~GetProcAddress(shlwapi&,214)
var IStream_Read&= ~GetProcAddress(shlwapi&,184)

proc StreamRelease-------------------------------------StreamRelease

    var VTable&=long(IStream&,0 )
    var Method&=long(VTable&,8 )
    call(Method&,IStream&)
    endproc-------------------------------------------------------------

    proc StreamToMem-----------------------------------------StreamToMem

        declare Size&
        call(IStream_Size&,IStream&,addr(Size&))
        dim PicData#,Size&
        call(IStream_Reset&,IStream&)
        call(IStream_Read&,IStream&,PicData#,Size&)
        endproc-------------------------------------------------------------

        proc MemToStream-----------------------------------------MemToStream

            call(IStream_Reset&,IStream&)
            call(IStream_Write&,IStream&,PicData#,sizeof(PicData#))
            endproc-------------------------------------------------------------

            Proc SaveJpgToStream---------------------------------SaveJpgToStream

                --Modifizierte Variante der SaveAsJPG-Prozedur von Andreas Miethe
                Parameters Bitmap&,Quality&
                Declare encoderCLSID#,result&
                result& = 0
                Dim encoderCLSID#,16
                Declare encoderParameters#
                Declare wTemp$,encoder#
                wTemp$ = S2WS(~EncoderQuality)
                Dim encoder#,16
                IIDFromString(ADDR(wTemp$),encoder#)
                Dim encoderParameters#,32
                Long encoderParameters#,0 = 1
                MoveMemory(encoderParameters#+4,encoder#,16)
                Long encoderParameters#,20 = 1
                Long encoderParameters#,24 = ~EncoderParameterValueTypeLong
                Long encoderParameters#,28 = ADDR(Quality&)

                If GetEncoderCLSID(image/jpeg,encoderCLSID#)

                    call(IStream_Reset&,IStream&)
                    ~GdipSaveImageToStream(Bitmap&,IStream&,encoderCLSID#,encoderParameters#)
                    result& = 1

                Endif

                Dispose encoder#
                Dispose encoderParameters#
                Dispose encoderCLSID#
                Return result&
                EndProc-------------------------------------------------------------
                external(ole32,CoInitialize,0)--OLE initialisieren
                var Token&=InitGDIPlus()------------GDI+ initialisieren
                usermessages 16---------------------WM_CLOSE abfangen
                declare PicData#,IStream&--PicData# und IStream& global deklariert!
                IStream&=call(SHCreateMemStream&,0,0)--Stream erzeugen
                var Pic&=create(hPic,-1,C:1TestBild.jpg)--Demo-Bild (Pfad anpassen!)
                declare Image&,Thumb&
                ~GdipCreateBitmapFromHBITMAP(Pic&,0,addr(Image&))--------Image von Bitmap
                ~GdipGetImageThumbnail(Image&,250,250,addr(Thumb&),0,0)--Thumb von Image (Größe 250*250)
                ~GdipDisposeImage(Image&)--------------------------------Image freigeben
                deleteobject Pic&----------------------------------------Bitmap freigeben
                SaveJpgToStream(Thumb&,5)----Thumb als JPG (schlechte Qualität) nach IStream&
                StreamToMem()----------------JPG-Daten von IStream& nach PicData#
                var LoQuality$=char$(PicData#,0,sizeof(PicData#))--PicData# als String zwischenspeichern
                SaveJpgToStream(Thumb&,100)--Thumb als JPG (gute Qualität) nach IStream&
                StreamToMem()----------------JPG-Daten von IStream& nach PicData#
                var HiQuality$=char$(PicData#,0,sizeof(PicData#))--PicData# als String zwischenspeichern
                declare Handle&,Bmp&
                char PicData#,0=LoQuality$--Daten aus String nach PicData#
                MemToStream()---------------Daten von PicData# nach IStream&
                ~GdipLoadImageFromStream(IStream&,addr(Handle&))----Image aus IStream&
                ~GdipCreateHBITMAPFromBitmap(Handle&,addr(Bmp&),0)--Bitmap aus Image
                ~GdipDisposeImage(Handle&)--------------------------Image freigeben
                drawpic Bmp&,10,10;0--------------------------------Bitmap anzeigen
                deleteobject Bmp&-----------------------------------Bitmap freigeben
                char PicData#,0=HiQuality$--Daten aus String nach PicData#
                MemToStream()---------------Daten von PicData# nach IStream&
                ~GdipLoadImageFromStream(IStream&,addr(Handle&))----Image aus IStream&
                ~GdipCreateHBITMAPFromBitmap(Handle&,addr(Bmp&),0)--Bitmap aus Image
                ~GdipDisposeImage(Handle&)--------------------------Image freigeben
                drawpic Bmp&,270,10;0-------------------------------Bitmap anzeigen
                deleteobject Bmp&-----------------------------------Bitmap freigeben

                while 1

                    waitinput
                    case %umessage=16:break

                endwhile

                StreamRelease()---------------------Stream freigeben
                external(ole32,CoUninitialize)--OLE aus
                ExitGDIPlus(Token&)-----------------GDI+ from

PS: The question to the maximalen Datenlänge related eigendlich on The @Decode64() -function, because iF the so betonte. so ließe itself JPG in DB namely too for conventional DBs (Memo-boxes or so) benefit.

SeeYou
Pascal
 
02/06/09  
 



in this example go correctly 10MB To 13MB To 10MB konvertiert by encode64 and decode64.
CompileMarkSeparation
cls
long l=1024*1024
string s=mkstr$(0123456789,l)
print len(s)/1024/1024,MB
s=encode64(s)
print len(s)/1024/1024,MB
s=decode64(s)
print len(s)/1024/1024,MB
print mid$(s,1,20)
print mid$(s,len(s)-19,20)
waitkey
CompileMarkSeparation
CLS
var L&=1024*1024
var s$=MKSTR$(0123456789,L&)
PRINT LEN(s$)/1024/1024,MB
S$=ENCODE64(s$)
PRINT LEN(s$)/1024/1024,MB
S$=DECODE64(s$)
PRINT LEN(s$)/1024/1024,MB
PRINT MID$(s$,1,20)
PRINT MID$(s$,LEN(s$)-19,20)
WAITKEY

1.025 kB
Hochgeladen:02/06/09
Downloadcounter84
Download
 
02/06/09  
 



wished time of of my Bmp-File(64x64Pixel) The RGB-values read. the Image has 3 different waagerechte
Farbstreifen(RGB). it come utterly incorrect values 31 0 31, 227 0 227 etc.

though pure RGB-values come should 255 0 0, 0 255 0, 0 0 255 zb.
window 30,30-500,500
 $H windows.ph
declare bmi#,b#
declare Pic$,Handle&,Neu&,wert&,hwin&
Window 20,20-200,200
hWin& = Create(Window, %hWnd, Test, 250, 20, 650,500)
Pic$=Test.bmp
Handle&=create(hPic,-1,Pic$)
struct bmpHEADER=Size&,Width&,Height&,Planes%,BitCount%,Compression&,SizeImage&,X#(24)
dim bmi#,bmpHEADER
bmi#.Size&=sizeof(bmi#)------------------Size of BITMAPINFOHEADER
~GetDIBits(%hdc,Handle&,0,0,0,bmi#,0)--Dummy-appeal, circa bmpHeader To fill (Return: 1=OK)
print sizeof(bmi#)
dim b#,bmi#.SizeImage&-----------------area for Bildinformationen (Pixel) provide
~GetDIBits(%hdc,Handle&,0,bmi#.Height&,b#,bmi#,0)--Eigendliche Bilddaten from lever detect
Neu&=~CreateDIBitmap(%hdc,bmi#,4,b#,bmi#,0)------new DIB with modified colours produce
startpaint hwin&
drawpic Neu&,10,10;0
endpaint
wert&=bmi#.SizeImage&

whileloop 0,wert&,4

    print byte(b#,&loop),byte(b#,&loop+1),byte(b#,&loop+2)
    sleep 10

endwhile

 
03/05/09  
 




Jörg
Sellmeyer
have Thou The Bitmap already with a external Program screen? If I einfarbige Bitmaps einsetze, go The values correctly outputted.
here's my Bitmap


15 kB
Hochgeladen:03/05/09
Downloadcounter174
Download
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
03/05/09  
 



The values have I by me screen, having any the value 255 in R, G and B.
with 2 Grafikprogrammen : Paintshop and Micrografx.

mfg
 
03/05/09  
 



by me not.
first comes of course 0 248 0 8x then again 224 7 224 8x and 31 0 31 8x the until schluss.

Zeig time your Ausleseprogramm.

mfg
 
03/05/09  
 



Wohlbemerkt The values imho not stature RGB separate BGR exist.
 
03/05/09  
 



playing now in the Test no role, derweil each colour the value 255 particular has. at least must the really with of/ one small Fluctuation seperat rauskommen and not these spending supra. Perhaps is my Aufrufreihenfolge wrong...

mfg
 
03/05/09  
 




Jörg
Sellmeyer
Peter Bierbachh
by me not.
first comes of course 0 248 0 8x then again 224 7 224 8x and 31 0 31 8x the until schluss.

Zeig time your Ausleseprogramm.

mfg


which Ausleseprogramm? I habs with your code read.
The Bitmap is with CorelDraw prepares.
Zeig still time your Bitmap.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
03/05/09  
 



in the attachment are The Bitmap.

mfg

15 kB
Hochgeladen:03/05/09
Downloadcounter172
Download
15 kB
Hochgeladen:03/05/09
Downloadcounter155
Download
 
03/05/09  
 




E.T.
even (because of yet-not-sleep-can ) time probiert:
Test1 and Test2.bmp show by me each 255 (remainder 0) for jeweilige colour on (Photoshop and AutoCad). likewise The bmp of Jörg.

The in the o.g. Source used Test.bmp is well not thereby or has at Upload whom name changed ??
 
Grüße aus Sachsen... Mario
WinXP, Win7 (64 Bit),Win8(.1),Win10, Win 11, Profan 6 - X4, XPSE, und 'nen schwarzes, blinkendes Dingens, wo ich das alles reinschütte...
03/06/09  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

19.192 Views

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie