Popular Post UEZ Posted November 15, 2012 Popular Post Share Posted November 15, 2012 (edited) Here a small tool to watermark any image supported by GDI+. This version is the enhanced version from AutoIt Windows Screenshooter.Screenshot:Download: AutoIt Watermark Image v0.89 beta build 2014-08-25.7z (942 download previously)Source code is too long to publish here -> PASTEBINYou are not allowed to sell this code or use it or just parts of it in a commercial project or modify it and distribute it with a different name!Some fonts may no be displayed properly because it is not GDI+ compatible!Appreciate any feedback (bugs, feature request, criticisms, etc.).@JScript: I created this on your request Coded and tested on Win7 x64 with Aero and AutoIt v3.3.12.0.Command line parametersMandatory: -text "Any Text" | -bitmap <path to an image used for stamp> -in <path to an image whichh should watermarked> -out <save image name> Optional: -font <font name from the dropdown list. Default is Arial> -size <font size. If 0 then it will be calculated automatically>> -color <color of the font. Default is 0xFF0000> -fx <one of the text fx -> default, outline or embossed. Default is Default> -fxtype <one of the modes -> Text, Circular or Stamp. Default is Text> -opaque <level of opaque (1-255). Default is 92> -pos <fixed position (1-9). Default is 9> -posx <manual x position. Default is 0> -posy <manual y position. Default is 0> -angle <in text/ circular mode the angle of the text (-180 - 180) or in stamp mode resize factor) -circrad <radius of the circular text. If 0 then it will be calculated automatically> -fill <fill stamp image -> 0 or 1. Default is 0) -format <jpg|png|gif|bmp|tif -> jpg is default> -jpgqual <jpg save quality (0-100). Default is 90) -loadfont <path to a ttf font file> -tpbgcolor <background color for transparent images> -silent <show or supress messages in cmd mode (0 | 1). If 1 then file will be overwritten automatically!>Credits: Authenticity (GDIP.au3), funkey (_GetFontInfoFromFilePtr()), Yashied (WinAPIEx.au3) and Melba23 (NoFocusLines.au3)Thanks to (alph. order): davidkim, funkey, JScript and Myicq for active supporting this little project!Br,UEZHistoryv0.50 beta build 2012-11-16: first releasev0.55 beta build 2012-11-16: added repaint feature for non aero desktops and added drag 'n' drop featurev0.60 beta build 2012-11-17: added resize featurev0.75 beta build 2012-11-23: rewritten rotation part, added emboss text effect, added slider to position text / image manually, added fill mode and command line supportv0.77 beta build 2012-11-26: fixed some small bugs, added minimize icon, added system fonts to combo box, added button to load any TrueType Font which doesn't need to be installed first and added Undo functionalityv0.77 beta build 2012-11-26: fixed a memory leak issue on WinXP and fixed crash on WinXP when 2nd image is loaded, some small bugs also fixedv0.80 beta build 2012-11-28: fixed a bug in Undo function (hard crash), fixed cutted rotated text, added suggestion from davidkim to move text with mousev0.84 beta build 2012-12-08: fixed some small bugs, added system menu (Check for Updates, Visit Homepage, About), added feature to select background color for transparent images (default is black), main GUI can be resized now (beta!), you can add a folder with images to watermark it all in CMD mode onlyv0.85 beta build 2012-12-12: some smaller bugs fixed, added rotation feature using right mouse buttonv0.87 beta build 2013-01-10: some smaller bugs fixed, added outlined filled text effect and disabled GUI resize feature (it will be enabled again when resize code is working much better than currently)v0.88 beta build 2013-05-24: some more bugs fixed and added Batch Conversion menu (without functionality yet)v0.88 beta build 2013-06-11: disabled GUI maximize button (yet properly GUI resizing not implemented)v0.89 beta build 2014-08-25: code adjusted to run on AutoIt v3.3.12.0, several internal modifications, water wave effect on pic when hovering it Edited September 26, 2014 by UEZ youtuber, funkey, Myicq and 6 others 9 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
engjcowi Posted November 15, 2012 Share Posted November 15, 2012 Looks great Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
mesale0077 Posted November 16, 2012 Share Posted November 16, 2012 nice code Link to comment Share on other sites More sharing options...
JScript Posted November 16, 2012 Share Posted November 16, 2012 @UEZWell done! Wonderful, I'll do some tests and return commenting!JS http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Chance Posted November 16, 2012 Share Posted November 16, 2012 You're a legend in this GDI stuff, like for real! Link to comment Share on other sites More sharing options...
Myicq Posted November 16, 2012 Share Posted November 16, 2012 It's when you see things like this you realize how far you have to go to master the AutoIT language. Awesome job! A few comments: In my PC, the color picker (choose color for text) totally messed up the gui when closing the color picker. Like the gui was not redrawn. Had to exit the program. Not sure if this is general. Also a suggestion or two: would be nice to have a ini or SQLite database settings file so that I could store and save settings from the program ? These could also be used with a sister script : command line version like c:> wmimg.exe /S mymark1 *.png to watermark using setting "mymark1" ..and perhaps also a drag-n-drop version now we are at the wishes ? But hey, wishes are free. Again: thank you for your awesome work so far. I will save this script and learn from it. I am just a hobby programmer, and nothing great to publish right now. Link to comment Share on other sites More sharing options...
UEZ Posted November 16, 2012 Author Share Posted November 16, 2012 @engjcowi, mesale0077, JScript, FlutterShy, Myicq: thanks for your feedback! @Myicq: what os are you using. which AutoIt version? I never saw this mess up! I will add drag 'n' drop, a sub menu for batch watermarking images and commandline options for batch processing from external programs. About saving settings to a ini file I need to think about it whether it makes sense. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Myicq Posted November 16, 2012 Share Posted November 16, 2012 (edited) UEZ, thanks for that.I think the settings file would be good, since you have so many options.My version info here:@AutoITVersion = 3.3.8.1 (I can use others no problem, just happened to test here)@OsBuild = 2600@OsType = Win32_NT@OSVersion = WIN_XP@OsLang = 0406 da_DK@OsServicePack = SP3Screenshot: Edited November 16, 2012 by Myicq I am just a hobby programmer, and nothing great to publish right now. Link to comment Share on other sites More sharing options...
UEZ Posted November 16, 2012 Author Share Posted November 16, 2012 I tested it in a VM running WinXP but the GUI still looks good after closing the color picker GUI. Does it appear also when you don't choose a color and press Cancel? Show me the screenshot please. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Myicq Posted November 16, 2012 Share Posted November 16, 2012 It does appear also after pressing Cancel. But there are 100s of things that can be different from my machine here to your VM. Btw: the gui also messes up if I drag your program around the screen, especially if I dragit outside visible screen area and back. Not sure why, perhaps GDI area / functions ? My simple Autoit scripts don't do this. Let me know how I can / should test for you. I am just a hobby programmer, and nothing great to publish right now. Link to comment Share on other sites More sharing options...
UEZ Posted November 16, 2012 Author Share Posted November 16, 2012 Can you replace this code with the original one and test again? Case $idButtonColor_WM $iColorFont_WM = _ChooseColor(2, $iColorFont_WM, 2, HWnd($hGUI_WM)) If Not @error Then GUICtrlSetBkColor($idButtonColor_WM, $iColorFont_WM) _WinAPI_RedrawWindow(HWnd($hGUI_WM), 0, 0, BitOR($RDW_INVALIDATE, $RDW_UPDATENOW)) UpdatePreview_WM() $iSaveColor_WM = $iColorFont_WM Else $iColorFont_WM = $iSaveColor_WM EndIf It is in the main While loop. Thanks, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Myicq Posted November 16, 2012 Share Posted November 16, 2012 (edited) Same thing, no difference after replacing that code block. But I think it's not releated to this button as dragging the GUI around also causes artifacts. Is there other GDI+ test suites, or somewhere I can identify versions of GDI+ ? Just to possibly target at my installation here, or potential version info clashes. EDIT: dragging issue seems to happen only when an image is loaded. Initially when no image is loaded I can drag as I want. Main window does not go "bad" Edited November 16, 2012 by Myicq I am just a hobby programmer, and nothing great to publish right now. Link to comment Share on other sites More sharing options...
UEZ Posted November 16, 2012 Author Share Posted November 16, 2012 Can you test it on a different PC with WinXP? Or just login with a different user on same PC? Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
funkey Posted November 16, 2012 Share Posted November 16, 2012 Hello UEZ, nice and useful script! ***** But on my WinXP I have the same error with messing up the window if a picure is loaded. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
UEZ Posted November 16, 2012 Author Share Posted November 16, 2012 (edited) Thanks to funkey who found the problem -> WM_ERASEBKGND_WM is causing the issue on non aero desktops, also on Win7! Br, UEZ Edited November 16, 2012 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
JScript Posted November 16, 2012 Share Posted November 16, 2012 Drag-and-drop would be wonderful, but not wanting to abuse, it would be great if had something related to image resizing, Madonna mia, splendid!For me to put multiple images on the web, it came came from heaven, it is easy to manipulate and very intuitive!!! again * 2...JS http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
UEZ Posted November 17, 2012 Author Share Posted November 17, 2012 (edited) Drag-and-drop would be wonderful, but not wanting to abuse, it would be great if had something related to image resizing, Madonna mia, splendid!For me to put multiple images on the web, it came came from heaven, it is easy to manipulate and very intuitive!!! again * 2...JSDrag 'n' drop is already implemented since version 0.55 and now in 0.60 you can resize the image -> press More button and select Resize.What will come next?: command line parameters to call it from a batch job which will be a pain in the ass to implement all the possible features and settings...Br,UEZ Edited November 17, 2012 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
JScript Posted November 17, 2012 Share Posted November 17, 2012 Nice! JS http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Myicq Posted November 20, 2012 Share Posted November 20, 2012 What will come next?: command line parameters to call it from a batch job which will be a pain in the ass to implement all the possible features and settings... Depends how you implement it, doesn't it ? I would myself do this: * in main GUI, make a button "save parameter set", ask for a name and save all parameters in an SQLite DB "settings.db" * from batch, call something like toolname.exe -s mysetup * you only need one parameter to check for. If left out, take a default. * possibly allow override of text to watermark ? * possibly allow parameter -f [db|ini] to use either SQLite or ini format. In any case, this looks very promising! I am just a hobby programmer, and nothing great to publish right now. Link to comment Share on other sites More sharing options...
UEZ Posted November 20, 2012 Author Share Posted November 20, 2012 (edited) That would make sense when all images have the same dimension! What if you have different image sizes? Just think about it (font size, image stamp size, radius, etc)! Otherwise you will use all default settings except color, position, type (circular / standard) and fx type of the text. Then it's not so hard I think. Is the issue with the messed up screen fixed now for you? Btw, I added "Emboss" as a text effect. I will release it when the rotation of the text is working as I want (I've rewritten that part). Br, UEZ Edited November 20, 2012 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ 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