AutoHotkey Community

It is currently May 27th, 2012, 4:53 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: January 22nd, 2009, 2:42 pm 
Offline

Joined: April 27th, 2008, 5:28 pm
Posts: 489
Mylistbox is defined earlier in the script and will have a file name in the format of
pic.jpg

I want to convert it to bmp and retain the original file name with the extension bmp. As in pic.bmp

I tried this
Code:
ConvertImage(mylistbox,"mylistbox.bmp")
this gave my converted picture the name
mylistbox.bmp


Code:
ConvertImage(MyListbox,MyListbox . ".bmp")
this gave my converted picture the name
pic.jpg.bmp


Code:
ConvertImage(mylistbox . ".jpg",mylistbox . ".bmp")
this gave my converted picture the name
pic.jpg

_________________
Check out my scripts.
(MyIpChanger) (XPSnap) (SavePictureAs)

All my scripts are tested on Windows 7, AutoHotkey_L 32 bit Ansi unless otherwise stated.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2009, 2:44 pm 
Offline

Joined: April 27th, 2008, 5:28 pm
Posts: 489
I was certain I could remove the extension from mylistbox because I read somewhere that convertimage() did not care what the original extension was.

I was hoping to avoid that.

thanks
DataLife

_________________
Check out my scripts.
(MyIpChanger) (XPSnap) (SavePictureAs)

All my scripts are tested on Windows 7, AutoHotkey_L 32 bit Ansi unless otherwise stated.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2009, 3:26 pm 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1833
lol, everyones disregarded that this function is old and rubbish :wink:

The gdi+ library will do this much better

Code:
#Include Gdip.ahk

pToken := Gdip_Startup()
pBitmap := Gdip_CreateBitmapFromFile("file.jpg")
Gdip_SaveBitmapToFile(pBitmap, "file.bmp")
Gdip_DisposeImage(pBitmap)
Gdip_Shutdown(pToken)


I know its longer, but that could all be wrapped into one function:

Code:
ConvertImage(sInput, sOutput)
{
   pBitmap := Gdip_CreateBitmapFromFile(sInput)
   Gdip_SaveBitmapToFile(pBitmap, sOutput)
   Gdip_DisposeImage(pBitmap)
}


Use that instead!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2009, 3:28 pm 
Offline

Joined: September 17th, 2006, 6:15 pm
Posts: 85
Location: Munique/Germany
tic wrote:
lol, everyones disregarded that this function is old and rubbish :wink:

The gdi+ library will do this much better

Code:
#Include Gdip.ahk

pToken := Gdip_Startup()
pBitmap := Gdip_CreateBitmapFromFile("file.jpg")
Gdip_SaveBitmapToFile(pBitmap, "file.bmp")
Gdip_DisposeImage(pBitmap)
Gdip_Shutdown(pToken)


I know its longer, but that could all be wrapped into one function:

Code:
ConvertImage(sInput, sOutput)
{
   pBitmap := Gdip_CreateBitmapFromFile(sInput)
   Gdip_SaveBitmapToFile(pBitmap, sOutput)
   Gdip_DisposeImage(pBitmap)
}


Use that instead!

tic,
can you past a image to the clipboard using your GDI lib?
Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2010, 11:28 pm 
Offline

Joined: December 28th, 2006, 9:46 am
Posts: 440
Is it possible to convert an input image from memory instead of from file?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2010, 1:06 am 
Offline

Joined: July 2nd, 2006, 9:04 pm
Posts: 25
Is there a way to get a hold of this function because the link in the OP doesn't work?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2010, 4:06 am 
A good idea would be a similar function for bitmaps stored in memory. For example using your GDI+ library. Not a convert image, but a simple resize.

Maybe there is one already, but I've not had much time to look. Then you could do:

Code:
pBitmap := ConvertImage(pBitmap, 200, 100)


See what I mean? If there is one already, I apologize.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2010, 10:13 am 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1833
you should check out the gdi+ library

and look at this post:

http://www.autohotkey.com/forum/viewtopic.php?p=330235#330235


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 13 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group