charvi Posted December 14, 2008 Share Posted December 14, 2008 Hi Autoiters, So far I am able to draw pictures (real huge photos) with GDI+: _GDIPlus_GraphicsDrawImage($h_DTHdc,$h_DTImage,0,0) but how can I resize the picture while plotting it on the screen? I know the picture's dimensions: $i_Width = _GDIPlus_ImageGetWidth ($h_DTImage) $i_Height = _GDIPlus_ImageGetHeight($h_DTImage) The _GDIPlus_GraphicsDrawImage() function contains X and Y coordinates, but no W and H... (width & height) Link to comment Share on other sites More sharing options...
monoceres Posted December 14, 2008 Share Posted December 14, 2008 Easy enough. _GDIPlus_GraphicsDrawImageRect() Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Andreik Posted December 14, 2008 Share Posted December 14, 2008 Here is an example:http://www.autoitscript.com/forum/index.ph...hl=image+resize When the words fail... music speaks. Link to comment Share on other sites More sharing options...
charvi Posted December 15, 2008 Author Share Posted December 15, 2008 Easy enough. _GDIPlus_GraphicsDrawImageRect() Thanks monoceres, but this is not what I am asking for. I'm asking how to reduce the image, while _GDIPlus_GraphicsDrawImageRect() just draws a rectangle, and the image is not being reduced to the rectangle size! I have a picture that is 1354x900 large and would like to reduce it to fit a rectangular zone of 800x600. Link to comment Share on other sites More sharing options...
charvi Posted December 15, 2008 Author Share Posted December 15, 2008 Here is an example:http://www.autoitscript.com/forum/index.ph...hl=image+resizeThanks Andreik, this is an excellent solution! and it works fine But isn't there a direct GDI+ solution ? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted December 15, 2008 Share Posted December 15, 2008 Thanks monoceres, but this is not what I am asking for. I'm asking how to reduce the image, while _GDIPlus_GraphicsDrawImageRect() just draws a rectangle, and the image is not being reduced to the rectangle size! I have a picture that is 1354x900 large and would like to reduce it to fit a rectangular zone of 800x600.I don't understand what you mean, if you want to draw a picture at another size it is _GDIPlus_GraphicsDrawImageRect() you need, if that's not it then you need to explain further what it is you really want. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
charvi Posted December 15, 2008 Author Share Posted December 15, 2008 I don't understand what you mean, if you want to draw a picture at another size it is _GDIPlus_GraphicsDrawImageRect() you need, if that's not it then you need to explain further what it is you really want.Yes, what I want is to draw a picture at another size, but I don't see how to achieve this with _GDIPlus_GraphicsDrawImageRect(). With other words, I would like to show thumbnails of my pictures on the screen. A thumbnail that is not larger than, say 200x200 pixels. Of course, the picture should not lose its aspect ratio, unless otherwise specified. This is my script, the image should fit a zone of 300x150 : _GDIPlus_GraphicsDrawRect($h_DT_Hdc, 5, 62, 300, 150, $h_DT_Pen) _GDIPlus_GraphicsDrawImage($h_DT_Hdc,$h_DT_Image,0,0) I don't understand how to show a thumbnail of the image with a function that just draws a rectangle only. If I use this, the picture Help file for _GDIPlus_GraphicsDrawRect() says: _GDIPlus_GraphicsDrawRect ---------------------------------------------------------------------------------------------------- Draw a rectangle ---------------------------------------------------------------------------------------------------- #Include <GDIPlus.au3> _GDIPlus_GraphicsDrawRect($hGraphics, $iX, $iY, $iWidth, $iHeight[, $hPen = 0]) ---------------------------------------------------------------------------------------------------- Parameters $hGraphics Handle to a Graphics object $iX The X coordinate of the upper left corner of the rectangle $iY The Y coordinate of the upper left corner of the rectangle $iWidth The width of the rectangle $iHeight The height of the rectangle $hPen Handle to a pen object that is used to draw the rectangle. If 0, a solid black pen with a width of 1 will be used Link to comment Share on other sites More sharing options...
monoceres Posted December 15, 2008 Share Posted December 15, 2008 You're looking at the wrong function. I said _GDIPlus_GraphicsDrawImageRect not _GDIPlus_GraphicsDrawRect Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
charvi Posted December 15, 2008 Author Share Posted December 15, 2008 You're looking at the wrong function. I said _GDIPlus_GraphicsDrawImageRect not _GDIPlus_GraphicsDrawRectFascinating...Indeed I used the wrong function. That's the problem with huge function names which have many ressemblence with other functions...Anyway, thank you for your great help. Now my problem is solved. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now