Sign in to follow this  
Followers 0
Edano

GDIPlus Image Editor / Color Transformer / Filter Effects / Convolutions / Embossing in a Pic Control

26 posts in this topic

#1 ·  Posted (edited)

this example script is the result of several threads, among others:

'?do=embed' frameborder='0' data-embedContent>>

'?do=embed' frameborder='0' data-embedContent>>

'?do=embed' frameborder='0' data-embedContent>>

.

[screenshot]

.

the script uses the GDIPlus v1.1 functions to manipulate images in a picture control.

winxp users can also run it with the instructions posted ?p=1079657'>here. a special GDIPlus_StartUp function is used.

it solves several problems in handling and combining graphical effects, color matrices, color transformings, balances, levels and attributes simultaneously on an image in a normal pic control, and additionally convolution matrices, embossing and edge detections.

.

taken down.

maybe this can be further developed into a real autoit image editor.

here is a nice example pic, if you need one. i borrowed it from >here.

.

.

if you want the 41 (!) convolution effects, you need the excellent Fasm.au3 (flat assembler) by Ward >here. download the entire zip file, because it needs the included MemoryDll.au3 as well. if you don't, you can comment out the line #include <Fasm.au3>, but you will miss a lot of fun. without his assembler, the convolutions wouldn't be possible in a reasonable speed.

also credits and thanks to Authenticity for his incredible Convolution.au3 >here. you don't need to download it, because i integrated it to my script.

have fun

Edano

Edit 1: added gamma, zoom, load, save

Edit 2: updated __GDIPlus_Startup()

Edit 3: added Convolution Matrix effects

Edit 4: improved zoom and some other features

Edit 5: added color matrices, color balance and tint effects

Edit 6: added HSL/HSB, color levels and greyscale with filters

Edited by Edano
2 people like this

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites



You should use english words only ;) and a save image option would be nice.

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

yes, save and some other functions ..... i plan to do it. now that i understand the basics, the rest should be easy. you noticed that the DrawimageFX function handles matrices and ImageAttributes as well as effects ? genial ! :) simplyfies it drastically.

i could offer to add some spanish and french vocabulary, if you like :) and kreol.


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

you noticed that the DrawimageFX function handles matrices and ImageAttributes as well as effects ? genial ! :) simplyfies it drastically.

 

Sure because I did the FX functions from your 1st link -> >post#7  ;) but there was a problem using DrawimageFX function for >my code which I cannot remember right now. 

For me is english ok but if you and others here want some translation go ahead.

Br,

UEZ

Edited 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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

updated the script. added zoom, gamma, load, save.

btw i realized that the thumbnail function must dispose of the image and the imageattribute cannot be reused and must be disposed of too.


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Looks good now. Smoother zooming would look nicer.

Br,

UEZ

Edited 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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

yes. i only coded 10% steps. a slider would be nicer probably. sooner or later i will have to rewrite the control gui.

though, i like it as it is .... :)

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

do you know if there is a bug in saving as .gif ? doesn't work for me.


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

It works properly for me.

What do you me with not working? If you want to overwrite an opened image then it won't work.

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Good work Edano.

There is an issue with the zoom function. Zooming large images seems to destroy the quality of the content (some blur occurs). It doesn't happen with smaller objects apparently.  I only tested jpg...

I also agree with UEZ that the zoom should be smoother. A slide bar would be more efficient. Look at UEZ's perforator example, that works very well.

And you really should put your labels in English as not everyone understands German.

Herzliche Grüße :)


Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

thx.

so, Schwarz-Weiß = black / white, Kontrast = contrast, Negativ = negative, Schärfe = sharpness, Radius = radius Gamma = gamma. did i forget anything ? i thought the really interesting part is the code.

the zoom i only added at last. maybe there is a better gdiplus function for zooming. i used the GetThumbnail function, so it really sounds as it is only made to shrink images. i will take a look around, could be a good idea.

but on the other hand, of course you need to fill in random pixels if you enlarge a pic that is already displayed in max quality.

E.

from >here: "The better zooming function is "StretchBlt" from "user32.dll""

and "GdipDrawImageRectRect" has automatic zoom. will make some tests.

or maybe even better is to always zoom from the original sized image and send it thru the effects afterwards..

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

It works properly for me.

What do you me with not working? If you want to overwrite an opened image then it won't work.

Br,

UEZ

 

.

for me it only returns 13 bytes .gifs. must be my system gif encoder is broken somehow.

E.

47494638376100000000700000 is the hex code = GIF87a...p..  that's all

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

You turned the $giGDIPRef parameter into a flag. Doesn't that break the whole point of it? Also I'm not sure why you are messing with the struct* parameters in __GDIPlus_Startup(). Are you running a pre 3.3.7.20 version??

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

You turned the $giGDIPRef parameter into a flag. Doesn't that break the whole point of it? Also I'm not sure why you are messing with the struct* parameters in __GDIPlus_Startup(). Are you running a pre 3.3.7.20 version??

 

true, i forgot to update __GDIPlus_Startup(). i'll do it right now. i was running an earlier version and noticed a problem with the params. when i updated autoit, i forgot about this. the current version is okay.

thx for the hint

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

updated the script. added 40 convolution effects. all effects can be combined. if you want to understand how that works, read this >post and the links. fascinating stuff.

the convolution matrix is the 3x3 square and this "kernel" is applied to every pixel in the image. various effects are possible, and you can add more matrices from the internet.

the "factor" is the sum of all matrix values, but not always, and should result 0 - but not always. the "weight" slider will change the pixel and increase or decrease the effect - or something different happens. the bias is obviously luminance. the "Rpt" button send the image once again thru the matrix. in a next version i will try to make all matrix fields editable.

i haven't yet changed the zoom function. i will work on that, and additionally plan to add color transforming effects.

please report any bugs, problems or improvements or more matrices to add. i am excited how far this will go.

Edano

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

I like the 40 convolution effects. Thanks for the matrices.

I would be nice when a loaded image is larger then the desktop dimension to scale it down to fit also on the screen.

Br,

UEZ

Edited 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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

yep, will do :) thx


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

post-79696-0-92674300-1370988527_thumb.j

Nice Convolution Matrix. 8 2 1 2 -11 2 1 -20 8 -7 5. i would call it "Van Gogh Filter" :)

Edit: forgot to say: you need to "repeat" the matrix twice.

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

updated the script. smooth zoom now. also, there shouldn't be any loss of quality anymore on zooming. this was more difficult than i expected. the zoom now always uses a new copy from the original image.

i left the $WM_HSCROLL message away to enable mouse and arrowkey on the sliders.

all convolution matrix fields are now editable, which is a lot of fun.

a little glitch still gives me headaches. when you zoom in and out and add a convolution matrix several times, there seems to be some confusion. this does not affect the script functionality or the image. it's just not as perfect as i would like it. will see if it will be possible to locate the problem.

E.


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

updated again. added color matrices, color balance and tint effects. that was easy.

still living with some glitches :)

enjoy

E.


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0