Jump to content

Recommended Posts

Posted

I've this script to make JPG files into TIF, and it doesn't work for me under seven.

After some research I also noticed that the example in the help file for _GDIPlus_ParamAdd doesn't work either (it makes both images, but the second one is just an exact copy of the first one)

So I figure some things don't work in GDI+ under W7, is this assumption correct?

The function for reference is:

Func ConvertImageToTiff($path,$path_out)
    Local $image
    Local $CLSID

    _GDIPlus_Startup()

    $image = _GDIPlus_BitmapCreateFromFile($path)

    #Region Tiff Parameters
    Local Const $TIFColorDepth = 24
    Local Const $TIFCompression = $GDIP_EVTCOMPRESSIONNONE
    Local $CLSID
    Local $tData
    Local $tParams
    Local $pParams

    $CLSID = _GDIPlus_EncodersGetCLSID("TIF")

    $tParams = _GDIPlus_ParamInit(2)
    $tData = DllStructCreate("int ColorDepth;int Compression")

    DllStructSetData($tData, "ColorDepth", $TIFColorDepth)
    DllStructSetData($tData, "Compression", $TIFCompression)

    _GDIPlus_ParamAdd($tParams, $GDIP_EPGCOLORDEPTH, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "ColorDepth"))
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGCOMPRESSION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Compression"))

    If IsDllStruct($tParams) Then
        $pParams = DllStructGetPtr($tParams)
    EndIf
    #EndRegion
    ;

    _GDIPlus_ImageSaveToFileEx($image, $path_out, $CLSID, $pParams)
    _GDIPlus_ImageDispose($image)
    _GDIPlus_Shutdown()
EndFunc

My problem here is that no matter what compression I try to assign, it forces LZW compression (even when I want no compression at all). And I need the file to be decompressed so I can work it with Tesseract

any ideas? =(

Posted (edited)

it does the same as my function does, it gives them LZW compression.

edit: I just tried _screencapture_capture as a tiff and it also defaults to lzw encription, I just want to know how to remove this compression, is that even possible under Seven?

Edited by Penny
Posted (edited)

great. it works but I need the script to be compiled for it to work (it didn't work out of the precompiled scripts.. why is that? it throws me an error (the same one that other user got in the thread you linked me)

C:\Users\Nico\Desktop\09-22\_FreeImageDll.au3 (45) : ==> Subscript used with non-Array variable.:
DllCall($dll,'int','_FreeImage_SaveU@16','int',$FIF_TIFF,'ptr',$hImage[0],'wstr',$dest,'int',0x0800)
DllCall($dll,'int','_FreeImage_SaveU@16','int',$FIF_TIFF,'ptr',$hImage^ ERROR

while the .exe file works without a problem.

Edited by Penny
Posted

Ok I got that to work by reinstalling Autoit a the 32 bit version, but I can't get other functions, even the simplest ones to work, for example, FreeImage_GetWidth and getheight both return 0 to me every time no matter how I use them.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...