AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

add border on images

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
image
Guest





PostPosted: Tue Mar 02, 2010 7:02 pm    Post subject: add border on images Reply with quote

GDI+
http://www.autohotkey.com/forum/topic32238.html
example 6

need help on adding a 30pixel wide white border on an existing png

situation: my printer setting likes cutting images off 10-20 pixels by itself, so everytime i print a screenshot of something, it will not print the top/bottom edges.
Back to top
closed



Joined: 07 Feb 2008
Posts: 509

PostPosted: Tue Mar 02, 2010 8:18 pm    Post subject: Reply with quote

Creating a canvas that is 60pixels larger than the image and centering the image on it?


Code:

#SingleInstance, Force
#NoEnv
SetBatchLines, -1
#Include, Gdip.ahk

FileSelectFile, file1

If !pToken := Gdip_Startup()
{
   MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
   ExitApp
}
pBitmapFile1 := Gdip_CreateBitmapFromFile(File1)
Width := Gdip_GetImageWidth(pBitmapFile1), Height := Gdip_GetImageHeight(pBitmapFile1)
w:=width+60
h:=height+60


pBitmap := Gdip_CreateBitmap(w, h)
G := Gdip_GraphicsFromImage(pBitmap)
pBrush := Gdip_BrushCreateSolid(0xffffffff)
Gdip_FillRectangle(G, pBrush, 0, 0, w, h)
Gdip_DeleteBrush(pBrush)

Gdip_DrawImage(G, pBitmapFile1, 30, 30, Width, Height, 0, 0, Width, Height)



Gdip_DisposeImage(pBitmapFile1)


Gdip_SaveBitmapToFile(pBitmap, "FinalImage.png")


Gdip_DisposeImage(pBitmap)
Gdip_DeleteGraphics(G)
Gdip_Shutdown(pToken)
ExitApp
Return
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group