Sign in to follow this  
Followers 0
Matteo

PNG to BMP

8 posts in this topic

Hi, i've a problem (i think this topic is alredy exist,but i don't find it),so:can i convert a image PNG to a BMP?please help me.


,.-~*´¨¯¨`*·~-.¸-(_[M]¦•¦[A]¦•¦[T]¦•¦[T]¦ •¦[E]¦•¦[O]_)-,.-~*´¨¯¨`*·~-.¸

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Example as Zedna said using AutoIt (beta) v3.2.9.14

#Include <GDIPlus.au3>

_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile(@SystemDir & "\DirectX\Dinput\act_rs.png")
$sCLSID = _GDIPlus_EncodersGetCLSID("BMP")
_GDIPlus_ImageSaveToFileEx($hImage, @ScriptDir & "\act_rs.bmp", $sCLSID)
_GDIPlus_ShutDown()

Cheers

Edit: Changed output from jpg to bmp.

Edited by smashly

Share this post


Link to post
Share on other sites

I try it, but it say:

C:\Programmi\AutoIt3\Include\GDIPlus.au3 (2026) : ==> Subscript used with non-Array variable.: 
Return SetError($aResult[0], 0, $aResult[2]) 
Return SetError($aResult^ ERROR
->15:02:22 AutoIT3.exe ended.rc:1
+>15:02:23 AutoIt3Wrapper Finished
>Exit code: 1   Time: 17.064

,.-~*´¨¯¨`*·~-.¸-(_[M]¦•¦[A]¦•¦[T]¦•¦[T]¦ •¦[E]¦•¦[O]_)-,.-~*´¨¯¨`*·~-.¸

Share this post


Link to post
Share on other sites

I try it, but it say:

C:\Programmi\AutoIt3\Include\GDIPlus.au3 (2026) : ==> Subscript used with non-Array variable.: 
Return SetError($aResult[0], 0, $aResult[2]) 
Return SetError($aResult^ ERROR
->15:02:22 AutoIT3.exe ended.rc:1
+>15:02:23 AutoIt3Wrapper Finished
>Exit code: 1    Time: 17.064
Use latest beta.

It works fine with 3.2.9.14 on my WINXP

Share this post


Link to post
Share on other sites

Use latest beta.

It works fine with 3.2.9.14 on my WINXP

I think yo are wrong Zedna. See this example of one of the functions in GDIPlus.au3

Func _GDIPlus_ImageLoadFromFile($sFileName)
    Local $aResult

    $aResult = DllCall($ghGDIPDll, "int", "GdipLoadImageFromFile", "wstr", $sFileName, "int*", 0)
    Return SetError($aResult[0], 0, $aResult[2])
EndFunc  ;==>_GDIPlus_ImageLoadFromFile

If there is an error in a dllcall then @error is set to 1 or 2 or 3 and the return result is not an array as assumed. I think the functions need to be corrected.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I think yo are wrong Zedna. See this example of one of the functions in GDIPlus.au3

Func _GDIPlus_ImageLoadFromFile($sFileName)
    Local $aResult

    $aResult = DllCall($ghGDIPDll, "int", "GdipLoadImageFromFile", "wstr", $sFileName, "int*", 0)
    Return SetError($aResult[0], 0, $aResult[2])
EndFunc  ;==>_GDIPlus_ImageLoadFromFile

If there is an error in a dllcall then @error is set to 1 or 2 or 3 and the return result is not an array as assumed. I think the functions need to be corrected.

You are right.

There is weak error checking.

But it should work OK as it is if no error occurs - for example not existing image or not installed GDI+ on WIN9x

EDIT: now I tested it also on my WIN98 and it works OK too

Edited by Zedna

Share this post


Link to post
Share on other sites

Hi, i've a problem (i think this topic is alredy exist,but i don't find it),so:can i convert a image PNG to a BMP?please help me.

Do you wanna do it with AutoIt or just generally how to convert a PNG to BMP !?

Greetz

Greenhorn

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0