Perfect
Perfect solution, didn't think of that DECLARE not passing byref.
Of course, things are always plain as day in hindsight.
Thanks!
Announcement
Collapse
No announcement yet.
GDI+ Jpeg Save Quality
Collapse
X
-
Change it to
Code:DECLARE FUNCTION GdipSaveImageToFile LIB "gdiplus.dll" ALIAS "GdipSaveImageToFile" (BYVAL lpImage AS DWORD, BYVAL flname AS STRING, clsidEncoder AS GUID, [B]BYREF EncoderParams AS encoderParameters[/B]) AS LONG
Leave a comment:
-
Code:DECLARE FUNCTION GdipSaveImageToFile LIB "gdiplus.dll" ALIAS "GdipSaveImageToFile" (BYVAL lpImage AS DWORD, BYVAL flname AS STRING, clsidEncoder AS GUID, OPT BYVAL EncoderParams AS encoderParameters) AS LONG
Leave a comment:
-
I think that you are filling the UDT correctly, but can you let us know which DECLARE are you using for GdipSaveImageToFile?
Leave a comment:
-
GDI+ Jpeg Save Quality
I've observed that the default jpg save quality using GDI+'s GdipSaveImageToFile leaves something to be desired. No trouble, I thought, I'll just adjust the quality.
I've got code to demonstrate the problem. The program is very long, but I believe I've enclosed enough code to show all relevant portions...
From the top, Types:
Code:TYPE EncoderParameter pGuid AS GUID NumberOfValues AS DWORD dwType AS DWORD Value AS DWORD END TYPE TYPE EncoderParameters pCount AS DWORD Parameter(0) AS EncoderParameter END TYPE
Code:$EncoderQuality = GUID$("{1D5BE4B5-FA4A-452D-9CDD-5DB35105E7EB}") %EncoderParameterValueTypeLong = 4
Code:DIM eps AS EncoderParameters eps.pCount = 1 eps.Parameter(0).pGuid = $EncoderQuality eps.Parameter(0).dwType = %EncoderParameterValueTypeLong eps.Parameter(0).NumberOfValues = 1 dwQuality& = 85 eps.Parameter(0).Value = VARPTR(dwQuality&) r& = GdipSaveImageToFile(img, FileSpec, sEncoderClsid, eps)
1. Drop the eps reference alltogether when calling GDIpSaveImageToFile or;
2. Change eps.pCount = 0
This tells me that there is something wrong with what I am putting into the eps structure. Thus, whatever is wrong must be in the above lines of code.
Any thoughts?Tags: None
Leave a comment: