Shoutbox

function to resize a picture - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: function to resize a picture (/showthread.php?tid=87707)

function to resize a picture by Guena on 12-12-2008 at 10:46 AM

Hi,


I need a function to resize a picture
Could someone please help me?

Thanks

Guéna


RE: function to resize a picture by matty on 12-12-2008 at 01:57 PM

How knowledgable are you with scripting? You are wanting to look at Gdip and GdipGetImageThumbnail which will allow you to resize the image in memory to be saved.

Try out some code because for us to just give you the code you will never learn.

Here are a good chunk of the functions you will need to complete such a task (in no particular order):

  • GdiplusStartup
  • GdiplusShutdown
  • GdipLoadImageFromFile
  • GdipCreateBitmapFromHBITMAP
  • GdipGetImageThumbnail
  • GdipCreateHBITMAPFromBitmap
  • CLSIDFromString
  • CLSIDFromString
  • GdipSaveImageToFile
  • DeleteObject

Best of luck!
RE: function to resize a picture by Guena on 12-12-2008 at 04:30 PM

Thank you very much. I beggin in scripting.

I'm working on a Skin and a Script which work together.
The script allow anybody to add his own picture to backgrounds available in my Skin.

You can see the evolution of my work here.

I need to resize the picture to automatically add a thumbnail to the option panel of the Skin.


RE: function to resize a picture by matty on 12-12-2008 at 05:09 PM

Well give it a try I have all the code that will do it already written but I recommend you try it out see if you can get it because you will learn that way and we can show you were you are going wrong.


RE: function to resize a picture by matty on 12-15-2008 at 02:01 PM

DId you mange to get it working?


RE: function to resize a picture by Guena on 12-15-2008 at 02:25 PM

Not yet, I'm learning how each function you gave me work


RE: function to resize a picture by matty on 12-15-2008 at 03:38 PM

Well once you have something post it and we will help you from there. Are you resizing an image that exists on the file system or are you capturing a screenshot and resizing it?


RE: function to resize a picture by Guena on 12-15-2008 at 05:09 PM

I'm resizing an image that exists on the file system.


RE: function to resize a picture by matty on 12-15-2008 at 05:32 PM

This is how you initialize Gdi+ I will give you that much for now:

jscript code:
var GdipToken = Interop.Allocate(4);
var GdipStartupInput = Interop.Allocate(16)
    GdipStartupInput.WriteDWORD(0, 1);

// will return True if successful false if it failed
function Gdip_Initialize () {
    return Interop.Call('gdiplus.dll', 'GdiplusStartup', GdipToken, GdipStartupInput, 0) === 0;
}

function Gdip_Uninitialize() {
    Interop.Call('gdiplus.dll', 'GdiplusShutdown', GdipToken.ReadDWORD(0));
}

RE: function to resize a picture by Guena on 12-18-2008 at 01:09 PM

Thank you very much.
I'm Waiting for a compatible version of MP!L with the WLM 9 RC to go on.


RE: function to resize a picture by matty on 02-04-2009 at 02:05 PM

Since the latest version is out did you manage to get this to work as you needed? Or did you give up?